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