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