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