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