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