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