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