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