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