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