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