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