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