Deck 13: Handling Events
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Match between columns
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/41
Play
Full screen (f)
Deck 13: Handling Events
1
Mouse events can be handled for any Control through an object of the class ____.
A) EventArgs
B) MouseEventArgs
C) MousePressEventArgs
D) MousePressArgs
A) EventArgs
B) MouseEventArgs
C) MousePressEventArgs
D) MousePressArgs
B
2
The ____ event occurs when the user clicks the mouse within the Control 's boundaries.
A) MouseClick
B) MouseEnter
C) MouseHover
D) MouseLeave
A) MouseClick
B) MouseEnter
C) MouseHover
D) MouseLeave
A
3
When you open the ____ file in an IDE, you can examine all the code generated by the Windows Form Designer for an application that creates a Form .
A) Designer.cs
B) EventHandlers.cs
C) Project.cs
D) Form.cs
A) Designer.cs
B) EventHandlers.cs
C) Project.cs
D) Form.cs
A
4
Any delegate can encapsulate any method that has the same return type and parameter list as the delegate.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
5
When you double-click the Button on the Form in the IDE, you generate the shell of a(n) ____ method.
A) Click
B) Double_Click
C) Enter
D) Focus
A) Click
B) Double_Click
C) Enter
D) Focus
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
6
In C#, a(n) ____ occurs when something interesting happens to an object.
A) error
B) event
C) note
D) callback
A) error
B) event
C) note
D) callback
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
7
A C# delegate is similar to a(n) ____ in C++, a variable that holds a method's memory address.
A) object pointer
B) integer pointer
C) function pointer
D) reference pointer
A) object pointer
B) integer pointer
C) function pointer
D) reference pointer
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
8
The ____ event occurs when the mouse cursor leaves the Control 's boundaries.
A) MouseClick
B) MouseEnter
C) MouseHover
D) MouseLeave
A) MouseClick
B) MouseEnter
C) MouseHover
D) MouseLeave
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
9
The C# language requires that every event must use a delegate type with three parameters.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
10
An event-handler method is also known as a(n) ____.
A) event source
B) event sender
C) sender object
D) event receiver
A) event source
B) event sender
C) sender object
D) event receiver
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
11
When an event occurs, any delegate that a client has given or passed to the event is invoked.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
12
For events that do not use additional information, the .NET Framework has already defined an appropriate delegate type named ____.
A) EventArgs
B) EventTrigger
C) EventPush
D) EventHandler
A) EventArgs
B) EventTrigger
C) EventPush
D) EventHandler
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
13
The code generated in Design mode in the IDE is not meant to be altered by typing. You should modify Control properties through the Properties window in the IDE.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
14
The second parameter in a Button event-handler parameter list is a reference to an event argument object of type ____.
A) MouseEventArgs
B) KeyEventArgs
C) EventArgs
D) KeyPressEventArgs
A) MouseEventArgs
B) KeyEventArgs
C) EventArgs
D) KeyPressEventArgs
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
15
You declare a delegate using the keyword ____.
A) handler
B) function
C) pointer
D) delegate
A) handler
B) function
C) pointer
D) delegate
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
16
The ____ class static field named Empty represents an event that contains no event data.
A) delegate
B) EventArgs
C) EventHandler
D) MouseArgs
A) delegate
B) EventArgs
C) EventHandler
D) MouseArgs
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
17
To declare your own event, you use a ____.
A) handler
B) trigger object
C) delegate
D) raiser
A) handler
B) trigger object
C) delegate
D) raiser
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
18
Programmers say that a button click ____ an event.
A) raises
B) closes
C) deletes
D) revokes
A) raises
B) closes
C) deletes
D) revokes
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
19
Events must be declared as private .
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
20
A(n) ____ provides a way for the clients of a class to dictate methods that should execute when an event occurs.
A) handler
B) event
C) delegate
D) trigger
A) handler
B) event
C) delegate
D) trigger
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
21
Keyboard events are also known as ____.
A) key events
B) external events
C) input events
D) console events
A) key events
B) external events
C) input events
D) console events
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
22
Given a GUI Control , what objects and delegates are provided to handle mouse events such as clicking, pointing, and dragging?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
23
A method that performs a task in response to an event is a(n) ____________________.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
24
Events are ____________________ occurrences; that is, they occur during the execution of a program rather than during development or at compile time.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
25
Depending on the event, the delegate used to create the keyboard event handler is either KeyEventHandler or ____.
A) PressEventHandler
B) EventHandler
C) KeyPressHandler
D) KeyPressEventHandler
A) PressEventHandler
B) EventHandler
C) KeyPressHandler
D) KeyPressEventHandler
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
26
The first parameter of an event-handler method is an object named ____________________; it is a reference to the object that generated the event.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
27
What are the two actions that can be taken on an event field?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
28
What are the default conventions for naming event handlers?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
29
When users encounter multiple GUI Control s on a Form , usually one Control has ____; that is, if the user presses the Enter key, the Control will raise an event.
A) contact
B) focus
C) range
D) interaction
A) contact
B) focus
C) range
D) interaction
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
30
Assume you declare three delegates named delegate1 , delegate2 , and delegate3 . You then assign a reference to method M1() to delegate1 , and a reference to method M2() to delegate2 . How do you make delegate3 into a composed delegate that executes both M1() and M2() ? What are the rules concerning return type and parameter list for composed delegates?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
31
____ occur when a user presses and releases keyboard keys.
A) Mouse events
B) Button events
C) Key events
D) Form events
A) Mouse events
B) Button events
C) Key events
D) Form events
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
32
You can use the + and += operators to combine delegates into a(n) ____________________ that calls the delegates from which it is built.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
33
What are common keyboard events? What is the delegate used to create a keyboard event handler, and what is the type of the second parameter to the event handler?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
34
What is an important difference between KeyEventArgs properties and KeyPressEventArgs properties?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
35
Given the delegate declaration: delegate void GreetingDelegate(string s);
What do you know about any method that is represented by this delegate? In general, what can you tell about a method if you know it is encapsulated by a particular delegate?
What do you know about any method that is represented by this delegate? In general, what can you tell about a method if you know it is encapsulated by a particular delegate?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
36
Connecting an event to its resulting actions is called event ____________________.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
37
____ is a Boolean property of a Control that identifies whether the Control will serve as a stopping place in a sequence of Tab key presses.
A) TabIndex
B) TabCount
C) TabStop
D) TabFlag
A) TabIndex
B) TabCount
C) TabStop
D) TabFlag
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
38
When you define your own event-handler delegate, what arguments are required? Provide an example of a delegate declaration.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
39
When a Form contains multiple Control s, you can create a separate event handler for each Control . However, you can also associate the same event handler with multiple Control s. Describe how to associate an existing event handler with a second Control using the IDE.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
40
The ____ event occurs when a mouse button is released while the mouse is within the Control 's boundaries.
A) MouseClick
B) MouseHover
C) MouseUp
D) MouseMove
A) MouseClick
B) MouseHover
C) MouseUp
D) MouseMove
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
41
Match between columns
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck