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