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