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