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