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