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