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 - We can use reserved keywords as identifiers in C# by prefixing them with @ character?

A - true

B - false

Answer : A

Explanation

if you want to use these keywords as identifiers, you may prefix the keyword with the @ character.

Q 2 - Value type variables in C# are derived from the class System.ValueType?

A - true

B - false

Answer : A

Explanation

Value type variables in C# are derived from the class System.ValueType.

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 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 8 - The comparison operators can be overloaded.

A - true

B - false

Answer : A

Explanation

The comparison operators can be overloaded.

Q 9 - You can define one namespace inside another namespace.

A - true

B - false

Answer : A

Explanation

You can define one namespace inside another namespace. You can access members of nested namespace by using the dot (.) operator.

Answer : C

Explanation

Both of the above options are correct.

csharp_questions_answers.htm
Advertisements