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