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