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