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