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