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