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