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

Q 1 - Which of the following is a contextual keyword in C#?

A - get

B - set

C - add

D - All of the above.

Answer : D

Explanation

All of the above options are contextual keywords.

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 64-bit integer in C#?

A - ToInt64

B - ToSbyte

C - ToSingle

D - ToInt32

Answer : A

Explanation

ToInt64() method converts a type to a 64-bit integer.

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 access specifier in C# allows a child class to access the member variables and member functions of its base class?

A - Public

B - Private

C - Protected

D - Internal

Answer : C

Explanation

Protected access specifier allows a child class to access the member variables and member functions of its base class.

Q 6 - Which of the following property of Array class in C# gets the rank (number of dimensions) of the Array?

A - Rank

B - LongLength

C - Length

D - None of the above.

Answer : A

Explanation

Rank gets the rank (number of dimensions) of the Array.

Q 8 - C# supports multiple inheritance.

A - true

B - false

Answer : B

Explanation

C# does not support multiple inheritance.

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.

csharp_questions_answers.htm
Advertisements