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