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