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