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