Chapter 8 Flashcards

1
Q

What is function pointer/delegate

A

Such a variable which contains the address of a function. A delegate in C# is similar to a function pointer in C or C++. Using a delegate allows the programmer to encapsulate a reference to a method inside a delegate object. The delegate object can then be passed to code which can call the referenced method, without having to know at compile time which method will be invoked. In fact, delegate is a variable the hold the reference of method.

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

How we initialize delegate

A

new keyword

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

Does event contains list of delegates

A

Yes

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

What does System.Windows.Form do

A

Give us GUI

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

What is try catch exception handling

A

Such a code where an exception code occur, we put it inside try block. And if exception occurs then also put it inside catch block.

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

What is finally block in try catch

A

The code inside finally block have to execute in all cases whether exception raises or not.

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

What happened if there is an exception and could not caught in try catch

A

OS will recognize it and program will crash. So there should not be uncaught exception.

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

What is throw

A

Exceptions can be explicitly generated by a program using the throw keyword

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

What is event registration

A

Adding a delegate in event list

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