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