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