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