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