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 2 - Which of the following converts a type to a Boolean value, where possible in C#?

A - ToBoolean

B - ToSingle

C - ToChar

D - ToDateTime

Answer : A

Explanation

ToBoolean() method converts a type to a Boolean value, where possible.

Q 3 - Which of the following converts a type to a 16-bit integer in C#?

A - ToDecimal

B - ToDouble

C - ToInt16

D - ToInt32

Answer : C

Explanation

ToInt16() method converts a type to a 16-bit integer.

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 method copies the reference to the memory location of an argument into the formal parameter?

A - Value parameters

B - Reference parameters

C - Output parameters

D - None of the above.

Answer : B

Explanation

Reference parameters method copies the reference to the memory location of an argument into the formal parameter.

Q 8 - Operator overloading is a kind of dynamic polymorphism.

A - true

B - false

Answer : B

Explanation

Opeator overloading is a kind of static polymorphism.

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 - Which of the following preprocessor directive allows generating a level one warning from a specific location in your code in C#?

A - warning

B - region

C - line

D - error

Answer : A

Explanation

#warning − It allows generating a level one warning from a specific location in your code.

csharp_questions_answers.htm
Advertisements