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