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