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