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