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