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