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