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