App Dev Worksheet: Events
Developer's tip (When this, do that): Event → handler → action: “on tap, do this”. The handler runs once for every tap. Counter: start + taps × step. A limit stops it growing; on = !on flips ON / OFF.
NameDateTime takenScore ___ / 40
-
1.👆 The user types Kabir in nameBox and taps the button 1 time. What does the label show?
button.onTap = function () {
label.text = "Welcome, " + nameBox.text + "!";
}; (a) Welcome! (b) Kabir (c) Welcome, Kabir! (d) Welcome, nameBox.text! - 2.True or false: one second passes is a text event. (a) False (b) True
-
3.👆 The user taps the button 5 times. What number does the label show now?
let score = 8;
button.onTap = function () {
score = score + 5;
label.text = score;
}; -
4.👆 The user taps the button 4 times. What number does the label show now?
let coins = 4;
button.onTap = function () {
coins = coins + 2;
label.text = coins;
}; - 5.👆 “On tap → do this” links an event to ___. (a) a web address (b) a font (c) a charger (d) an action
-
6.👆 The user taps the button 2 times. What number does the label show now?
let lives = 2;
button.onTap = function () {
lives = lives + 2;
label.text = lives;
}; -
7.👆 The user taps the button 5 times. What does the label show now?
let on = false;
button.onTap = function () {
on = !on;
if (on) {
label.text = "ON";
} else {
label.text = "OFF";
}
}; (a) OFF (b) ON - 8.👆 What kind of event is this: a 5-minute alarm ends? (a) a load event (b) a timer event (c) a tap event (d) a text event
-
9.👆 The user taps the button 7 times. What number does the label show now?
let likes = 0;
button.onTap = function () {
if (likes < 2) {
likes = likes + 1;
}
label.text = likes;
}; -
10.👆 The user taps the button 3 times. What does the label show now?
let on = false;
button.onTap = function () {
on = !on;
if (on) {
label.text = "ON";
} else {
label.text = "OFF";
}
}; (a) OFF (b) ON -
11.👆 The user taps the button 6 times. What number does the label show now?
let score = 5;
button.onTap = function () {
score = score + 1;
label.text = score;
}; -
12.👆 The user taps the button 4 times. What number does the label show now?
let likes = 0;
button.onTap = function () {
if (likes < 2) {
likes = likes + 1;
}
label.text = likes;
}; -
13.👆 The user taps the button 1 times. What number does the label show now?
let likes = 0;
button.onTap = function () {
if (likes < 4) {
likes = likes + 1;
}
label.text = likes;
}; -
14.👆 The user taps the button 2 times. What number does the label show now?
let likes = 0;
button.onTap = function () {
if (likes < 4) {
likes = likes + 1;
}
label.text = likes;
}; -
15.👆 The user taps the button 2 times. What number does the label show now?
let stars = 8;
button.onTap = function () {
stars = stars + 2;
label.text = stars;
}; -
16.👆 The user taps the button 4 times. What does the label show now?
let on = false;
button.onTap = function () {
on = !on;
if (on) {
label.text = "ON";
} else {
label.text = "OFF";
}
}; (a) OFF (b) ON -
17.👆 The user taps the button 7 times. What does the label show now?
let on = false;
button.onTap = function () {
on = !on;
if (on) {
label.text = "ON";
} else {
label.text = "OFF";
}
}; (a) OFF (b) ON - 18.👆 An event in an app is ___. (a) a kind of list (b) something that happens (c) a colour theme (d) an app store
- 19.True or false: the user taps Play is a timer event. (a) True (b) False
- 20.👆 What kind of event is this: the user taps Play? (a) a load event (b) a timer event (c) a tap event (d) a text event
- 21.True or false: the screen first opens is a load event. (a) False (b) True
- 22.👆 What kind of event is this: the user types a letter? (a) a load event (b) a text event (c) a tap event (d) a timer event
-
23.👆 The user taps the button 2 times. What number does the label show now?
let points = 1;
button.onTap = function () {
points = points + 1;
label.text = points;
}; -
24.👆 The user taps the button 8 times. What number does the label show now?
let likes = 0;
button.onTap = function () {
if (likes < 5) {
likes = likes + 1;
}
label.text = likes;
}; - 25.👆 What kind of event is this: the user presses Save? (a) a tap event (b) a load event (c) a text event (d) a timer event
-
26.👆 The user taps the button 4 times. What number does the label show now?
let points = 2;
button.onTap = function () {
points = points + 1;
label.text = points;
}; -
27.👆 The user taps the button 3 times. What number does the label show now?
let likes = 0;
button.onTap = function () {
if (likes < 5) {
likes = likes + 1;
}
label.text = likes;
}; -
28.👆 The user taps the button 2 times. What number does the label show now?
let likes = 0;
button.onTap = function () {
if (likes < 3) {
likes = likes + 1;
}
label.text = likes;
}; - 29.👆 Which of these is an event? (a) the icon colour (b) the font size (c) a list of names (d) the user taps a button
-
30.👆 The user types Kabir in nameBox and taps the button 1 time. What does the label show?
button.onTap = function () {
label.text = "Well done, " + nameBox.text + "!";
}; (a) Well done, nameBox.text! (b) Well done! (c) Kabir (d) Well done, Kabir! -
31.👆 The user taps the button 2 times. What does the label show now?
let on = false;
button.onTap = function () {
on = !on;
if (on) {
label.text = "ON";
} else {
label.text = "OFF";
}
}; (a) ON (b) OFF - 32.True or false: a finger hits Like is a timer event. (a) False (b) True
- 33.👆 What kind of event is this: one second passes? (a) a text event (b) a load event (c) a tap event (d) a timer event
- 34.True or false: the user taps Play is a text event. (a) True (b) False
-
35.👆 The user taps the button 4 times. What number does the label show now?
let stars = 4;
button.onTap = function () {
stars = stars + 2;
label.text = stars;
}; -
36.👆 The user types Riya in nameBox and taps the button 1 time. What does the label show?
button.onTap = function () {
label.text = "Welcome, " + nameBox.text + "!";
}; (a) Riya (b) Welcome, Riya! (c) Welcome, nameBox.text! (d) Welcome! -
37.👆 The user taps the button 3 times. What number does the label show now?
let lives = 2;
button.onTap = function () {
lives = lives + 5;
label.text = lives;
}; -
38.👆 The user taps the button 7 times. What number does the label show now?
let likes = 0;
button.onTap = function () {
if (likes < 4) {
likes = likes + 1;
}
label.text = likes;
}; -
39.👆 The user taps the button 1 times. What does the label show now?
let on = false;
button.onTap = function () {
on = !on;
if (on) {
label.text = "ON";
} else {
label.text = "OFF";
}
}; (a) ON (b) OFF - 40.True or false: the user taps Play is a tap event. (a) False (b) True
Answer key
- Welcome, Kabir!
- False
- 33
- 12
- an action
- 6
- ON
- a timer event
- 2
- ON
- 11
- 2
- 1
- 2
- 12
- OFF
- ON
- something that happens
- False
- a tap event
- True
- a text event
- 3
- 5
- a tap event
- 6
- 3
- 2
- the user taps a button
- Well done, Kabir!
- OFF
- False
- a timer event
- False
- 12
- Welcome, Riya!
- 17
- 4
- ON
- True
Free app development lessons, practice and worksheets at talentjr.in/app-development-for-students