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