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