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