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