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