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
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
What class has a static field named Empty that represents an event that contains no event data?
A) delegate
B) EventArgs
C) EventHandler
D) MouseArgs
A) delegate
B) EventArgs
C) EventHandler
D) MouseArgs
B
2
Events must be declared as private.
False
3
The C# language requires that every event must use a delegate type with three parameters.
False
4
In a button event-handler parameter list, the second argument is an object of what 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
5
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
6
A C# delegate is similar to what variable type in C++ 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
7
What 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
8
What file can be opened to 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
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
9
What 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
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
10
What keyword can be used to declare a delegate?
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
11
What provides a way for the clients of a class to dictate methods that should execute when an event occurs?
A) a handler
B) an event
C) a delegate
D) a trigger
A) a handler
B) an event
C) a delegate
D) a trigger
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
12
When you double-click a Button on a Form in the IDE, you automatically generate the shell of what 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
13
What term can be used to describe an event-handler method?
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
14
What is used to declare your own event in C#?
A) handlers
B) trigger objects
C) delegates
D) raisers
A) handlers
B) trigger objects
C) delegates
D) raisers
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
15
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
16
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
17
What is another term for the performing of an action, such as the click of a button by a user?
A) raising an event
B) closing a loop
C) deleting an instance
D) chaining an action
A) raising an event
B) closing a loop
C) deleting an instance
D) chaining an action
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
18
In C#, when something interesting happens to an object, what is said to have occurred?
A) an error
B) an event
C) a memory dump
D) a method callback
A) an error
B) an event
C) a memory dump
D) a method callback
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
19
For events that do not use additional information, the .NET Framework has already defined an appropriate delegate type with what name?
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
20
Mouse events can be handled for any control through an object of what class?
A) MouseEvent
B) MouseEventArgs
C) MousePressEventArgs
D) MousePressArgs
A) MouseEvent
B) MouseEventArgs
C) MousePressEventArgs
D) MousePressArgs
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
21
When users encounter multiple GUI Controls on a Form, and a user presses the Enter key, what usually happens?
A) The Form will check the default key action for the enter key in the Designer.cs file.
B) The Control that has focus will raise an event.
C) The Control that is closest to the mouse pointer will be activated.
D) Nothing will happen unless the enter key has a KeyPressHandler event defined.
A) The Form will check the default key action for the enter key in the Designer.cs file.
B) The Control that has focus will raise an event.
C) The Control that is closest to the mouse pointer will be activated.
D) Nothing will happen unless the enter key has a KeyPressHandler event defined.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
22
What are the properties of the MouseEventArgs class?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
23
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
24
What Boolean property of a Control 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
25
An event that occurs as a result of interaction with the keyboard is known as what type of event?
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
26
The connection of an event to its resulting actions is known by what term?
A) event wiring
B) event triggering
C) event watching
D) event connecting
A) event wiring
B) event triggering
C) event watching
D) event connecting
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
27
Describe the methods that could be encapsulated by a delegate that has been defined as: delegate void GreetingDelegate(string s);
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
28
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
29
What property stores the key code along with any modifier key for a key event?
A) KeyCode
B) KeyValue
C) KeyData
D) KeyStatus
A) KeyCode
B) KeyValue
C) KeyData
D) KeyStatus
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
30
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
31
Depending on the event, the delegate used to create the keyboard event handler is either KeyEventHandler or what other event handler?
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
32
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
33
What 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
34
When a Form contains multiple Controls, you can create a separate event handler for each Control.However, you can also associate the same event handler with multiple Controls.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
35
What expression describes the act of calling an event method?
A) cascading the event
B) revoking the event
C) invoking the event
D) composing the event
A) cascading the event
B) revoking the event
C) invoking the event
D) composing the event
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
36
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
37
What is the relationship between an event sender and event receiver?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
38
What happens when the TabIndex values of two or more Controls is set to 0?
A) An Exception is thrown, and the program ends.
B) No errors are generated, but only one Control will receive focus.
C) After setting one Control to 0, the other Control will be forced to a 1 or other unique number.
D) Both Controls will receive focus at the same time.
A) An Exception is thrown, and the program ends.
B) No errors are generated, but only one Control will receive focus.
C) After setting one Control to 0, the other Control will be forced to a 1 or other unique number.
D) Both Controls will receive focus at the same time.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
39
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
40
For static methods, what does a delegate object encapsulate?
A) The class utilized by the methods.
B) The arguments passed to the methods.
C) The method to be called.
D) Custom events defined within the methods.
A) The class utilized by the methods.
B) The arguments passed to the methods.
C) The method to be called.
D) Custom events defined within the methods.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
41
When you click a component on a Form in Design View, you move to the default method code.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck