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