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