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