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

Answer : D

Explanation

All of the above options are correct.

Answer : A

Explanation

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

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 determines whether an object is of a certain type in C#?

A - ?:

B - is

C - as

D - *

Answer : B

Explanation

is operator determines whether an object is of a certain type.

Q 5 - Which of the following access specifier in C# allows a class to hide its member variables and member functions from other class objects and functions, except a child class within the same application?

A - Protected Internal

B - Private

C - Protected

D - Internal

Answer : A

Explanation

Protected Internal access specifier allows a class to hide its member variables and member functions from other class objects and functions, except a child class within the same application.

Answer : D

Explanation

All of the above options are correct.

Answer : D

Explanation

All of the above options are correct.

Q 9 - Which of the following preprocessor directive allows you to undefine a symbol in C#?

A - define

B - undef

C - region

D - endregion

Answer : B

Explanation

#undef: It allows you to undefine a symbol.

Q 10 - Which of the following preprocessor directive lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor in C#?

A - warning

B - region

C - line

D - error

Answer : B

Explanation

#region − It lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor.

csharp_questions_answers.htm
Advertisements