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