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