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