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