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