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