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