C# Interview

Exceptions, Delegates, Events & Lambdas

C# interview questions covering exceptions, delegates, events & lambdas.

10 Questions Filter by level

Interview questions

Open a question for the full answer, code and interview guidance.

10 Results
51
Mid-LevelIntermediate

What is exception handling in C#?

Exception handling is the mechanism used to detect and handle runtime errors in a controlled way. C# primarily uses try, catch, finally, and throw.

52
Mid-LevelIntermediate

What is the difference between throw and throw ex in C#?

When rethrowing the current exception from a catch block, throw; preserves the original stack trace. Using throw ex; resets important stack-trace information to the current location, making debugging harder.

53
Mid-LevelIntermediate

What is a custom exception in C#?

A custom exception is an application-specific exception type, normally derived from Exception. It can represent a meaningful business or domain failure that built-in exception types do not describe clearly.

54
Mid-LevelIntermediate

What is a delegate in C#?

A delegate is a type-safe reference to one or more methods with a compatible signature. It allows methods to be passed around as values and invoked indirectly.

55
Mid-LevelIntermediate

What are Action, Func, and Predicate delegates?

Action, Func, and Predicate are built-in generic delegate types.

56
Mid-LevelIntermediate

What is a lambda expression in C#?

A lambda expression is a concise way to represent an anonymous function. Lambdas are commonly used with delegates, LINQ, events, and asynchronous APIs.

57
Mid-LevelIntermediate

What is an anonymous method in C#?

An anonymous method is an unnamed method defined using the delegate keyword. It was introduced before lambda expressions and can still be used, although lambdas are usually shorter and more idiomatic in modern C#.

58
Mid-LevelIntermediate

What is an event in C#?

An event provides a publisher-subscriber mechanism built on delegates. A publisher exposes an event, and subscribers register handlers that execute when the event is raised.

59
Mid-LevelIntermediate

What is the difference between a delegate and an event?

A delegate is a type-safe method reference that can be assigned and invoked according to its accessibility. An event is a restricted publisher-subscriber abstraction built on a delegate.

60
Mid-LevelIntermediate

What is a multicast delegate in C#?

A multicast delegate can reference multiple methods. When invoked, the methods in its invocation list are called in order.