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