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