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