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