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