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