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