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 single Unicode character, where possible in C#?

A - ToSingle

B - ToByte

C - ToChar

D - ToDateTime

Answer : C

Explanation

ToChar() method converts a type to a single Unicode character, where possible.

Q 3 - Which of the following converts a floating point or integer type to a decimal type in C#?

A - ToDecimal

B - ToDouble

C - ToInt16

D - ToInt32

Answer : A

Explanation

ToDecimal() method converts a floating point or integer type to a decimal 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 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 8 - Function overloading is a kind of static polymorphism.

A - true

B - false

Answer : A

Explanation

Function overloading is a kind of static polymorphism.

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.

csharp_questions_answers.htm
Advertisements