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