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