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