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