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