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