Practice Event in CS Thinking

Use these practice problems to test your method after reviewing the concept explanation and worked examples.

Quick Recap

A detectable action or occurrence in a program, such as a user click, key press, or timer expiry.

Something happens (click, keypress, timer) and the program reacts.

Example 1

easy
In a GUI application, a user clicks a 'Submit' button. Describe what happens in terms of events and event handling.

Example 2

medium
Compare event-driven programming with sequential programming. Give an example of each.

Example 3

medium
A simple alarm clock app has these features: set alarm time, snooze for 5 minutes, dismiss alarm. Identify the events and describe what each event handler should do.

Example 4

hard
In a game, multiple events can occur simultaneously: a key is pressed, a timer fires, and two objects collide. Explain how an event queue handles this, and why the order of handling might matter.