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 score = 3;
score = score - 1;
score = score + 2;
show(score); - 2.True or false: photos on two devices fits saving in the cloud. (a) True (b) False
-
3.💾 What number does this code show?
let points = 4;
points = points - 1;
points = points + 5;
show(points); - 4.💾 Data saved only on the phone is lost when ___. (a) the screen turns off (b) the app is closed (c) the phone is lost (d) you send a message
-
5.💾 pop() takes off the last item. What does this code show?
let friends = ["Kabir", "Zoya", "Meera", "Aman", "Riya"];
friends.pop();
show(friends[friends.length - 1]); (a) Aman (b) Kabir (c) Meera (d) Zoya -
6.💾 pop() takes off the last item. What does this code show?
let friends = ["Arjun", "Meera", "Aman"];
friends.pop();
show(friends[friends.length - 1]); (a) Arjun (b) Aman (c) Meera - 7.💾 Where should the app save notes to read offline: on the phone or in the cloud? (a) on the phone (b) in the cloud
- 8.Which of these fits saving in the cloud? (a) the sound on/off setting (b) notes to read offline (c) a shared to-do list (d) your last game level
-
9.💾 What does this code show? (Positions start at 0.)
let songs = ["Kites", "Monsoon", "Stars", "Rain", "Sunrise"];
show(songs[3]); (a) Kites (b) Monsoon (c) Stars (d) Rain - 10.💾 Which works with no internet at all? (a) a cloud leaderboard (b) data saved on the phone (c) a shared chat (d) a cloud backup
- 11.💾 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
-
12.💾 What number does this code show?
let notes = ["Hindi", "Music"];
notes.push("Maths");
notes.push("Sports");
show(notes.length); -
13.💾 What number does this code show?
let coins = 4;
coins = coins - 4;
coins = coins + 5;
show(coins); -
14.💾 What number does this code show?
let songs = ["Kites", "Ocean", "Monsoon"];
songs.push("Sunrise");
songs.push("Stars");
show(songs.length); - 15.💾 Where should the app save your last game level: on the phone or in the cloud? (a) in the cloud (b) on the phone
- 16.Which of these fits saving in the cloud? (a) the sound on/off setting (b) a draft you are typing (c) notes to read offline (d) photos on two devices
-
17.💾 What does this code show? (Positions start at 0.)
let songs = ["Kites", "Sunrise", "Ocean"];
show(songs[2]); (a) Sunrise (b) Ocean (c) Kites -
18.💾 pop() takes off the last item. What does this code show?
let songs = ["Sunrise", "Rain", "Ocean", "Stars", "Monsoon"];
songs.pop();
show(songs[songs.length - 1]); (a) Rain (b) Ocean (c) Sunrise (d) Stars - 19.True or false: a shared to-do list fits saving in the cloud. (a) True (b) False
- 20.Which of these fits saving on the phone? (a) a class leaderboard (b) notes to read offline (c) chat messages to friends (d) photos on two devices
- 21.💾 Where should the app save photos on two devices: on the phone or in the cloud? (a) in the cloud (b) on the phone
-
22.💾 What does this code show? (Positions start at 0.)
let friends = ["Meera", "Riya", "Aman", "Kabir"];
show(friends[0]); (a) Meera (b) Riya (c) Aman (d) Kabir - 23.True or false: a class leaderboard fits saving in the cloud. (a) False (b) True
- 24.True or false: notes to read offline fits saving on the phone. (a) False (b) True
-
25.💾 What number does this code show?
let score = 4;
score = score - 1;
score = score + 3;
show(score); -
26.💾 pop() takes off the last item. What does this code show?
let notes = ["Maths", "Hindi", "Music"];
notes.pop();
show(notes[notes.length - 1]); (a) Music (b) Maths (c) Hindi -
27.💾 What number does this code show?
let friends = ["Aman", "Riya", "Arjun"];
friends.push("Zoya");
friends.push("Meera");
show(friends.length); - 28.True or false: a shared to-do list fits saving on the phone. (a) True (b) False
-
29.💾 pop() takes off the last item. What does this code show?
let songs = ["Sunrise", "Ocean", "Monsoon", "Kites", "Rain"];
songs.pop();
show(songs[songs.length - 1]); (a) Sunrise (b) Kites (c) Ocean (d) Monsoon -
30.💾 What number does this code show?
let songs = ["Stars", "Sunrise", "Rain"];
songs.push("Monsoon");
songs.push("Kites");
show(songs.length); - 31.True or false: the sound on/off setting fits saving in the cloud. (a) True (b) False
-
32.💾 What does this code show? (Positions start at 0.)
let notes = ["Maths", "Hindi", "Science", "Art"];
show(notes[2]); (a) Maths (b) Art (c) Hindi (d) Science -
33.💾 What does this code show? (Positions start at 0.)
let notes = ["Maths", "Art", "Hindi", "Music"];
show(notes[3]); (a) Maths (b) Art (c) Hindi (d) Music - 34.True or false: the sound on/off setting fits saving on the phone. (a) True (b) False
-
35.💾 What number does this code show?
let notes = ["Sports", "Maths"];
notes.push("Music");
show(notes.length); -
36.💾 What number does this code show?
let notes = ["Maths", "Art", "Science", "Hindi"];
notes.push("Sports");
notes.push("Music");
show(notes.length); - 37.💾 In most code, the first item of a list is at position ___. (a) 10 (b) 0 (c) 2 (d) 1
- 38.True or false: your last game level fits saving in the cloud. (a) False (b) True
-
39.💾 What does this code show? (Positions start at 0.)
let songs = ["Stars", "Kites", "Sunrise", "Rain"];
show(songs[0]); (a) Rain (b) Sunrise (c) Stars (d) Kites -
40.💾 pop() takes off the last item. What does this code show?
let songs = ["Kites", "Rain", "Stars", "Ocean"];
songs.pop();
show(songs[songs.length - 1]); (a) Stars (b) Rain (c) Kites (d) Ocean
Answer key
- 4
- True
- 8
- the phone is lost
- Aman
- Meera
- on the phone
- a shared to-do list
- Rain
- data saved on the phone
- in the cloud
- 4
- 5
- 5
- on the phone
- photos on two devices
- Ocean
- Stars
- True
- notes to read offline
- in the cloud
- Meera
- True
- True
- 6
- Hindi
- 5
- False
- Kites
- 5
- False
- Science
- Music
- True
- 3
- 6
- 0
- False
- Stars
- Stars
Free app development lessons, practice and worksheets at talentjr.in/app-development-for-students