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