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