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