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