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