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