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