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