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