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