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