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