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