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