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