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