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