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