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