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