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