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