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