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