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