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