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