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