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