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 3 - Which of the following converts a type (integer or string type) to date-time structures in C#?

A - ToString

B - ToSingle

C - ToChar

D - ToDateTime

Answer : D

Explanation

ToDateTime() method converts a type (integer or string type) to date-time structures.

Q 4 - Which of the following converts a type to an unsigned long type in C#?

A - ToType

B - ToUInt16

C - ToUInt32

D - ToString

Answer : C

Explanation

ToUInt32() method converts a type to an unsigned long type.

Q 5 - Which of the following method copies the actual value of an argument into the formal parameter of the function?

A - Value parameters

B - Reference parameters

C - Output parameters

D - None of the above.

Answer : A

Explanation

Value parameters method copies the actual value of an argument into the formal parameter of the function.

Q 6 - Which of the following property of Array class in C# checks whether the Array is readonly?

A - IsFixedSize

B - IsReadOnly

C - Length

D - None of the above.

Answer : B

Explanation

IsReadOnly gets a value indicating whether the Array is readonly.

Q 7 - Which of the following is the default access specifier of a class member variable?

A - Private

B - Public

C - Protected

D - Internal

Answer : A

Explanation

Default access for the class member variables is Private.

Q 8 - Dynamic polymorphism is implemented by abstract classes and virtual functions.

A - true

B - false

Answer : A

Explanation

Dynamic polymorphism is implemented by abstract classes and virtual functions.

Q 9 - Which of the following preprocessor directive defines a sequence of characters as symbol in C#?

A - define

B - undef

C - region

D - endregion

Answer : A

Explanation

#define: It defines a sequence of characters, called symbol.

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