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