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