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