C# Online Quiz



Following quiz provides Multiple Choice Questions (MCQs) related to C#. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 1 - We can use reserved keywords as identifiers in C#?

A - true

B - false

Answer : B

Explanation

Keywords are reserved words predefined to the C# compiler. These keywords cannot be used as identifiers.

Answer : C

Explanation

Both of the above options are correct.

Q 3 - Which of the following converts a type (integer or string type) to date-time structures in C#?

A - ToString

B - ToSingle

C - ToChar

D - ToDateTime

Answer : D

Explanation

ToDateTime() method converts a type (integer or string type) to date-time structures.

Q 4 - Which of the following operator determines whether an object is of a certain type in C#?

A - ?:

B - is

C - as

D - *

Answer : B

Explanation

is operator determines whether an object is of a certain type.

Q 5 - Which of the following access specifier in C# allows a class to expose its member variables and member functions to other functions and objects?

A - Public

B - Private

C - Protected

D - Internal

Answer : A

Explanation

Public access specifier allows a class to expose its member variables and member functions to other functions and objects.

Answer : D

Explanation

All of the above options are correct.

Q 8 - The assignment operators cannot be overloaded.

A - true

B - false

Answer : A

Explanation

The assignment operators cannot be overloaded.

Q 9 - Which of the following preprocessor directive allows generating an error from a specific location in your code in C#?

A - define

B - region

C - line

D - error

Answer : D

Explanation

#error − It allows generating an error from a specific location in your code.

Q 10 - The finally block is used to execute a given set of statements, whether an exception is thrown or not thrown.

A - true

B - false

Answer : A

Explanation

The finally block is used to execute a given set of statements, whether an exception is thrown or not thrown.

csharp_questions_answers.htm
Advertisements