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