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