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