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