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