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