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