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