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