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