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