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