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