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