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