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