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