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