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