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