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