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