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