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