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