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 variable types can be assigned a value directly in C#?

A - Value types

B - Reference types

C - Pointer types

D - All of the above.

Answer : A

Explanation

Value type variables can be assigned a value directly.

Q 2 - Which of the following converts a type to a byte value in C#?

A - ToSingle

B - ToByte

C - ToChar

D - ToDateTime

Answer : B

Explanation

ToByte() method converts a type to a byte.

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

A - ToDecimal

B - ToDouble

C - ToInt16

D - ToInt32

Answer : B

Explanation

ToDouble() method converts a type to a double type.

Q 4 - Which of the following operator creates a pointer to a variable in C#?

A - sizeof

B - typeof

C - &

D - *

Answer : D

Explanation

* operator creates a pointer to a variable.

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.

Q 8 - The conditional logical operators can be overloaded.

A - true

B - false

Answer : B

Explanation

The conditional logical operators cannot be overloaded.

Q 9 - Which of the following preprocessor directive specifies the end of a conditional directive in C#?

A - elif

B - endif

C - if

D - else

Answer : B

Explanation

#endif − Specifies the end of a conditional directive.

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