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