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