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