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