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