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