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