1. Which of the following is the entry point of a C# console application?
A) MainForm()
B) Start()
C) static void Main()
D) Run()
Answer: C) static void Main()
Explanation: In a C# console application, the static void Main() method is the
default entry point. It can optionally take arguments like string[] args.
2. What is the base class of all types in .NET?
A) ValueType
B) Object
C) System
D) Type
Answer: B) Object
Explanation: All types in .NET, including value types and reference types, derive from the
[Link] class.
3. Which of the following correctly declares a nullable integer in C#?
A) int nullableInt;
B) nullable int i;
C) int? i;
D) Int i = null;
Answer: C) int? i;
Explanation: In C#, int? is the shorthand for Nullable<int>, allowing the variable to
hold null.
4. Which method is used to release unmanaged resources in .NET?
A) Dispose()
B) Finalize()
C) Close()
D) Shutdown()
Answer: A) Dispose()
Explanation: Dispose() is part of the IDisposable interface and is used to explicitly
release unmanaged resources.
5. Which keyword is used to define an abstract class in C#?
A) virtual
B) static
C) abstract
D) override
Answer: C) abstract
Explanation: abstract is used to declare a class that cannot be instantiated and may
contain abstract methods.
6. What is the default access modifier for a class in C#?
A) private
B) protected
C) internal
D) public
Answer: C) internal
Explanation: By default, classes have internal access, meaning they are accessible
only within the same assembly.
7. Which method in [Link] is used to execute a SELECT query and
return a DataReader?
A) ExecuteScalar()
B) ExecuteReader()
C) ExecuteNonQuery()
D) ExecuteQuery()
Answer: B) ExecuteReader()
Explanation: ExecuteReader() returns a DataReader object to read data in a
forward-only stream.
8. Which [Link] object is used for disconnected data access?
A) DataReader
B) SqlCommand
C) SqlConnection
D) DataSet
Answer: D) DataSet
Explanation: DataSet stores data in memory and supports disconnected data access.
9. What is the purpose of the "using" statement in C#?
A) To import namespaces
B) To define asynchronous code
C) To handle exceptions
D) To create generics
Answer: A) To import namespaces
Explanation: The using statement is primarily used to include namespaces, though it is
also used to ensure resource disposal.