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 - Which of the following is a reserved keyword in C#?

A - abstract

B - as

C - foreach

D - All of the above.

Answer : D

Explanation

All of the above options are reserved keywords.

Answer : D

Explanation

All of the above options are correct.

Q 3 - Which of the following converts a type to a string in C#?

A - ToInt64

B - ToSbyte

C - ToSingle

D - ToString

Answer : D

Explanation

ToString() method converts a type to a string.

Q 4 - Which of the following converts a type to an unsigned int type in C#?

A - ToType

B - ToUInt16

C - ToSingle

D - ToString

Answer : B

Explanation

ToUInt16() method converts a type to an unsigned int 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 in the current assembly?

A - Public

B - Private

C - Protected

D - Internal

Answer : D

Explanation

Internal access specifier allows a class to expose its member variables and member functions to other functions and objects in the current assembly.

Q 6 - Which of the following property of Array class in C# checks whether the Array has a fixed size?

A - IsFixedSize

B - IsStatic

C - Length

D - None of the above.

Answer : A

Explanation

IsFixedSize gets a value indicating whether the Array has a fixed size.

Q 8 - The comparison operators can be overloaded.

A - true

B - false

Answer : A

Explanation

The comparison operators can be overloaded.

Q 9 - Which of the following preprocessor directive allows to create a compound conditional directive, along with #if in C#?

A - define

B - elif

C - if

D - else

Answer : D

Explanation

#else − It allows to create a compound conditional directive, along with #if.

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