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