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