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