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