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