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