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