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