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