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