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