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