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