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