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