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