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