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