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