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