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