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.👆 What kind of event is this: the screen first opens? (a) a text event (b) a tap event (c) a load event (d) a timer event
-
2.👆 The user types Meera in nameBox and taps the button 1 time. What does the label show?
button.onTap = function () {
label.text = "Hi, " + nameBox.text + "!";
}; (a) Hi, nameBox.text! (b) Hi, Meera! (c) Meera (d) Hi! -
3.👆 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 -
4.👆 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 - 5.True or false: a countdown hits zero is a timer event. (a) True (b) False
- 6.True or false: a 5-minute alarm ends is a timer event. (a) True (b) False
- 7.👆 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
- 8.👆 What kind of event is this: one second passes? (a) a load event (b) a tap event (c) a timer event (d) a text event
- 9.👆 What kind of event is this: the search box changes? (a) a load event (b) a timer event (c) a tap event (d) a text event
-
10.👆 The user taps the button 4 times. What number does the label show now?
let score = 1;
button.onTap = function () {
score = score + 4;
label.text = score;
}; -
11.👆 The user taps the button 4 times. What number does the label show now?
let coins = 2;
button.onTap = function () {
coins = coins + 3;
label.text = coins;
}; -
12.👆 The user taps the button 3 times. What number does the label show now?
let lives = 2;
button.onTap = function () {
lives = lives + 3;
label.text = lives;
}; - 13.👆 An event in an app is ___. (a) a colour theme (b) an app store (c) a kind of list (d) something that happens
-
14.👆 The user taps the button 6 times. What number does the label show now?
let likes = 0;
button.onTap = function () {
if (likes < 5) {
likes = likes + 1;
}
label.text = likes;
}; - 15.True or false: the screen first opens is a load event. (a) False (b) True
- 16.👆 What kind of event is this: the user taps Play? (a) a text event (b) a load event (c) a timer event (d) a tap event
- 17.True or false: the search box changes is a timer event. (a) True (b) False
-
18.👆 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 -
19.👆 The user taps the button 7 times. What number does the label show now?
let likes = 0;
button.onTap = function () {
if (likes < 3) {
likes = likes + 1;
}
label.text = likes;
}; -
20.👆 The user types Zoya in nameBox and taps the button 1 time. What does the label show?
button.onTap = function () {
label.text = "Well done, " + nameBox.text + "!";
}; (a) Zoya (b) Well done, nameBox.text! (c) Well done! (d) Well done, Zoya! -
21.👆 The user taps the button 6 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 -
22.👆 The user types Meera in nameBox and taps the button 1 time. What does the label show?
button.onTap = function () {
label.text = "Welcome, " + nameBox.text + "!";
}; (a) Welcome, nameBox.text! (b) Welcome! (c) Welcome, Meera! (d) Meera -
23.👆 The user taps the button 6 times. What number does the label show now?
let score = 1;
button.onTap = function () {
score = score + 1;
label.text = score;
}; -
24.👆 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) Welcome! (b) Welcome, Riya! (c) Welcome, nameBox.text! (d) Riya -
25.👆 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;
}; -
26.👆 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) ON (b) OFF -
27.👆 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 -
28.👆 The user taps the button 4 times. What number does the label show now?
let lives = 2;
button.onTap = function () {
lives = lives + 2;
label.text = lives;
}; -
29.👆 The user taps the button 4 times. What number does the label show now?
let likes = 0;
button.onTap = function () {
if (likes < 3) {
likes = likes + 1;
}
label.text = likes;
}; - 30.True or false: the app starts up is a load event. (a) True (b) False
- 31.👆 A tap handler runs how many times if the user taps 4 times? (a) 0 (b) 8 (c) 4 (d) 1
-
32.👆 The user taps the button 3 times. What number does the label show now?
let likes = 0;
button.onTap = function () {
if (likes < 3) {
likes = likes + 1;
}
label.text = likes;
}; -
33.👆 The user taps the button 5 times. What number does the label show now?
let coins = 10;
button.onTap = function () {
coins = coins + 3;
label.text = coins;
}; -
34.👆 The user taps the button 3 times. What number does the label show now?
let points = 0;
button.onTap = function () {
points = points + 1;
label.text = points;
}; - 35.👆 What kind of event is this: the app starts up? (a) a timer event (b) a text event (c) a tap event (d) a load event
- 36.True or false: the search box changes is a text event. (a) True (b) False
- 37.👆 “On tap → do this” links an event to ___. (a) a charger (b) a web address (c) an action (d) a font
-
38.👆 The user taps the button 5 times. What number does the label show now?
let lives = 1;
button.onTap = function () {
lives = lives + 5;
label.text = lives;
}; -
39.👆 The user taps the button 4 times. What number does the label show now?
let coins = 0;
button.onTap = function () {
coins = coins + 4;
label.text = coins;
}; - 40.👆 What kind of event is this: the user types a letter? (a) a tap event (b) a timer event (c) a text event (d) a load event
Answer key
- a load event
- Hi, Meera!
- OFF
- ON
- True
- True
- a tap event
- a timer event
- a text event
- 17
- 14
- 11
- something that happens
- 5
- True
- a tap event
- False
- ON
- 3
- Well done, Zoya!
- OFF
- Welcome, Meera!
- 7
- Welcome, Riya!
- 2
- ON
- OFF
- 10
- 3
- True
- 4
- 3
- 25
- 3
- a load event
- True
- an action
- 26
- 16
- a text event
Free app development lessons, practice and worksheets at talentjr.in/app-development-for-students