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