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