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