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