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