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