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