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