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