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