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