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