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