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