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