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 : A

Explanation

When a value type is converted to object type, it is called boxing.

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

A - ToDecimal

B - ToDouble

C - ToInt16

D - ToInt32

Answer : D

Explanation

ToInt32() method converts a type to a 32-bit integer.

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 8 - Dynamic polymorphism is implemented by abstract classes and virtual functions.

A - true

B - false

Answer : A

Explanation

Dynamic polymorphism is implemented by abstract classes and virtual functions.

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.

Q 10 - Which of the following preprocessor directive marks the end of a #region block in C#?

A - warning

B - region

C - endregion

D - error

Answer : C

Explanation

#endregion − It marks the end of a #region block.


csharp_questions_answers.htm

Advertisements