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