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