C# Online Quiz


Advertisements

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

Answer : D

Explanation

All of the above options are correct.

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 small floating point number in C#?

A - ToInt64

B - ToSbyte

C - ToSingle

D - ToInt32

Answer : C

Explanation

ToSingle() method converts a type to a small floating point number.

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 child class to access the member variables and member functions of its base class?

A - Public

B - Private

C - Protected

D - Internal

Answer : C

Explanation

Protected access specifier allows a child class to access the member variables and member functions of its base class.

Q 6 - Which of the following property of Array class in C# gets a 64-bit integer, the total number of elements in all the dimensions of the Array?

A - Rank

B - LongLength

C - Length

D - None of the above.

Answer : B

Explanation

LongLength gets a 64-bit integer that represents the total number of elements in all the dimensions of the Array.

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 creating a compound conditional directive in C#?

A - elif

B - define

C - if

D - else

Answer : A

Explanation

#elif − It allows creating a compound conditional directive.

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