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