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