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