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