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