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