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