Unit 3: Event driven architecture Flashcards

1
Q

What is sequential programming?

A

A programming approach where the program is in control and user input occurs in a predefined sequence.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is event-driven programming?

A

A programming style where the user controls the flow through actions (events), and the program responds accordingly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Give an example of sequential programming.

A

A command-line program prompting the user for input step-by-step.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Give an example of event-driven programming.

A

A GUI app with buttons for simulating cars entering and exiting a car park.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an event in programming?

A

An action like a button press, mouse click, or window resize that occurs and the program can respond to.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an event handler?

A

A method that is automatically called in response to a specific event, such as a button being pressed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the event loop?

A

The continuous cycle of waiting for an event, reacting to it, and then waiting again.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Who runs the event loop in Java GUI applications?

A

The Java Virtual Machine (JVM).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What method is used to handle button clicks in Java?

A

public void actionPerformed(ActionEvent event)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does event.getSource() do in Java?

A

It checks which GUI element (like a button) triggered the event.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you update a text field in Java GUI?

A

Using text.setText(“your text here”).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What happens in the actionPerformed method?

A

It reacts to events like button presses by running specific code depending on the event source.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly