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