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