*
Previous C# Question Answers-121 - 130 Thread Synchronization in C# Next

C# (C-Sharp) Question Answers - 131-140

131. Top .NET class that everything is derived from?

System.Object

132. Purpose of finally block in try..catch?

Used to clean up resources; executes whether or not an exception occurred.

133. When must a class be declared abstract?

  • When inheriting from an abstract class and not all abstract methods are overridden.
  • When at least one method in the class is abstract.

134. Why arguments are important in catch statement?

Specifying a System.Exception object ensures only known exceptions are caught and handled properly.

135. Why can’t you specify accessibility modifier for methods in an interface?

All interface members must be public by default.

136. Will finally block execute if no exception occurs?

Yes

137. Can font object be modified within using statement?

using (Font font = new Font("Arial", 10.0f))
{
  font = new Font("Verdana", 10.0f); // Not allowed; throws exception
}

138. What is C# and how is it different from Java/Python?

C# is statically typed, object-oriented, with richer syntax (properties, events). Enforces type safety unlike Python.

139. Role of CLR in C#?

Common Language Runtime manages execution, memory, type safety, and cross-language interoperability.

140. Difference between ref and out parameters?

  • ref requires initialization before passing.
  • out does not require initialization, but must be assigned inside the method.
Back to Index
Previous C# Question Answers-121 - 130 Thread Synchronization in C# Next
*
*