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