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