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