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