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