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