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