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