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