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