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