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