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