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