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