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