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