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

Explanation

Both 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 type to a specified type in C#?

A - ToType

B - ToSbyte

C - ToSingle

D - ToString

Answer : A

Explanation

ToType() method converts a type to a specified type.

Q 4 - Which of the following operator returns the type of a class in C#?

A - sizeof

B - typeof

C - &</a>

D - *

Answer : B

Explanation

typeof() operator returns the type of a class.

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

A - Public

B - Private

C - Protected

D - Internal

Answer : B

Explanation

Private access specifier allows a class to hide its member variables and member functions from other functions and objects.

Q 6 - Which of the following property of Array class in C# gets a 32-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 : C

Explanation

Length gets a 32-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 testing a symbol or symbols to see if they evaluate to true in C#?

A - define

B - undef

C - if

D - elif

Answer : C

Explanation

#if − It allows testing a symbol or symbols to see if they evaluate to true.

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