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