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