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