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