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