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