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