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