App Dev Worksheet: Variables, Lists and Saving
Developer's tip (Box, list, place): A variable holds one value; a list holds many in order. Positions start at 0. push adds to the end; pop takes off the last item; length is how many items. On the phone: works offline, private. In the cloud: shared, any device, needs the internet.
NameDateTime takenScore ___ / 40
-
1.💾 What number does this code show?
let coins = 7;
coins = coins - 1;
coins = coins + 1;
show(coins); - 2.💾 Which works with no internet at all? (a) a cloud backup (b) data saved on the phone (c) a shared chat (d) a cloud leaderboard
-
3.💾 What number does this code show?
let songs = ["Rain", "Monsoon", "Stars"];
songs.push("Sunrise");
songs.push("Kites");
show(songs.length); -
4.💾 What number does this code show?
let stars = 8;
stars = stars - 4;
stars = stars + 4;
show(stars); - 5.Which of these fits saving on the phone? (a) chat messages to friends (b) the sound on/off setting (c) a class leaderboard (d) a shared to-do list
- 6.💾 Where should the app save photos on two devices: on the phone or in the cloud? (a) on the phone (b) in the cloud
-
7.💾 What number does this code show?
let coins = 5;
coins = coins - 3;
coins = coins + 4;
show(coins); -
8.💾 What number does this code show?
let coins = 9;
coins = coins - 8;
coins = coins + 5;
show(coins); -
9.💾 pop() takes off the last item. What does this code show?
let friends = ["Aman", "Kabir", "Meera", "Zoya"];
friends.pop();
show(friends[friends.length - 1]); (a) Meera (b) Zoya (c) Aman (d) Kabir -
10.💾 pop() takes off the last item. What does this code show?
let notes = ["Hindi", "Art", "Maths", "Science", "Sports"];
notes.pop();
show(notes[notes.length - 1]); (a) Science (b) Art (c) Hindi (d) Maths -
11.💾 What number does this code show?
let songs = ["Ocean", "Stars"];
songs.push("Sunrise");
show(songs.length); -
12.💾 What number does this code show?
let notes = ["Maths", "Art", "Music", "Sports"];
notes.push("Science");
notes.push("Hindi");
show(notes.length); -
13.💾 What does this code show? (Positions start at 0.)
let friends = ["Aman", "Kabir", "Zoya", "Arjun"];
show(friends[1]); (a) Zoya (b) Kabir (c) Aman (d) Arjun - 14.💾 Data saved only on the phone is lost when ___. (a) the screen turns off (b) the phone is lost (c) the app is closed (d) you send a message
-
15.💾 What number does this code show?
let songs = ["Stars", "Ocean"];
songs.push("Kites");
show(songs.length); - 16.💾 Where should the app save the sound on/off setting: on the phone or in the cloud? (a) in the cloud (b) on the phone
-
17.💾 What does this code show? (Positions start at 0.)
let friends = ["Zoya", "Arjun", "Meera"];
show(friends[2]); (a) Arjun (b) Meera (c) Zoya -
18.💾 What number does this code show?
let notes = ["Science", "Art", "Maths"];
notes.push("Sports");
show(notes.length); - 19.💾 Which can hold many values in order? (a) a switch (b) a single number (c) a list (d) a button
- 20.💾 Where should the app save a shared to-do list: on the phone or in the cloud? (a) in the cloud (b) on the phone
- 21.True or false: your last game level fits saving in the cloud. (a) False (b) True
- 22.💾 What is a variable? (a) a phone setting (b) a picture (c) a type of screen (d) a named box for a value
- 23.Which of these fits saving in the cloud? (a) your last game level (b) photos on two devices (c) notes to read offline (d) a draft you are typing
-
24.💾 What number does this code show?
let notes = ["Hindi", "Art", "Science", "Sports"];
notes.push("Music");
show(notes.length); - 25.Which of these fits saving on the phone? (a) a shared to-do list (b) chat messages to friends (c) your last game level (d) a class leaderboard
- 26.💾 Where should the app save your last game level: on the phone or in the cloud? (a) on the phone (b) in the cloud
- 27.Which of these fits saving in the cloud? (a) a draft you are typing (b) a shared to-do list (c) the sound on/off setting (d) notes to read offline
-
28.💾 pop() takes off the last item. What does this code show?
let notes = ["Science", "Hindi", "Maths", "Sports"];
notes.pop();
show(notes[notes.length - 1]); (a) Sports (b) Hindi (c) Maths (d) Science - 29.True or false: chat messages to friends fits saving in the cloud. (a) False (b) True
- 30.💾 Where should the app save chat messages to friends: on the phone or in the cloud? (a) on the phone (b) in the cloud
-
31.💾 pop() takes off the last item. What does this code show?
let songs = ["Ocean", "Rain", "Monsoon"];
songs.pop();
show(songs[songs.length - 1]); (a) Ocean (b) Rain (c) Monsoon - 32.True or false: notes to read offline fits saving in the cloud. (a) False (b) True
-
33.💾 pop() takes off the last item. What does this code show?
let notes = ["Music", "Sports", "Science", "Hindi"];
notes.pop();
show(notes[notes.length - 1]); (a) Hindi (b) Science (c) Sports (d) Music - 34.True or false: the sound on/off setting fits saving on the phone. (a) False (b) True
-
35.💾 What number does this code show?
let friends = ["Arjun", "Aman"];
friends.push("Riya");
show(friends.length); - 36.Which of these fits saving in the cloud? (a) a draft you are typing (b) the sound on/off setting (c) chat messages to friends (d) notes to read offline
- 37.💾 Where should the app save notes to read offline: on the phone or in the cloud? (a) in the cloud (b) on the phone
- 38.Which of these fits saving on the phone? (a) chat messages to friends (b) notes to read offline (c) photos on two devices (d) a shared to-do list
-
39.💾 What number does this code show?
let notes = ["Hindi", "Music", "Science"];
notes.push("Maths");
show(notes.length); - 40.True or false: photos on two devices fits saving in the cloud. (a) True (b) False
Answer key
- 7
- data saved on the phone
- 5
- 8
- the sound on/off setting
- in the cloud
- 6
- 6
- Meera
- Science
- 3
- 6
- Kabir
- the phone is lost
- 3
- on the phone
- Meera
- 4
- a list
- in the cloud
- False
- a named box for a value
- photos on two devices
- 5
- your last game level
- on the phone
- a shared to-do list
- Maths
- True
- in the cloud
- Rain
- False
- Science
- True
- 3
- chat messages to friends
- on the phone
- notes to read offline
- 4
- True
Free app development lessons, practice and worksheets at talentjr.in/app-development-for-students