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