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