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