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