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