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