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