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