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