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.

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 string in C#?

A - ToInt64

B - ToSbyte

C - ToSingle

D - ToString

Answer : D

Explanation

ToString() method converts a type to a string.

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

A - sizeof

B - typeof

C - &</a>

D - *

Answer : A

Explanation

sizeof() operator returns the size of a data type.

Q 5 - Which of the following method helps in returning more than one value?

A - Value parameters

B - Reference parameters

C - Output parameters

D - None of the above.

Answer : C

Explanation

Output parameters method helps in returning more than one value.

Answer : D

Explanation

All of the above options are correct.

Q 8 - C# does not support multiple inheritance.

A - true

B - false

Answer : A

Explanation

C# does not support multiple inheritance.

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.

Q 10 - Which of the following preprocessor directive allows generating a level one warning from a specific location in your code in C#?

A - warning

B - region

C - line

D - error

Answer : A

Explanation

#warning − It allows generating a level one warning from a specific location in your code.


csharp_questions_answers.htm

Advertisements