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