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