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