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