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