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