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