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