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