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