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