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