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