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