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