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