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