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