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