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 - Which of the following converts a type to a Boolean value, where possible in C#?

A - ToBoolean

B - ToSingle

C - ToChar

D - ToDateTime

Answer : A

Explanation

ToBoolean() method converts a type to a Boolean value, where possible.

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 determines whether an object is of a certain type in C#?

A - ?:

B - is

C - as

D - *

Answer : B

Explanation

is operator determines whether an object is of a certain 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# checks whether the Array has a fixed size?

A - IsFixedSize

B - IsStatic

C - Length

D - None of the above.

Answer : A

Explanation

IsFixedSize gets a value indicating whether the Array has a fixed size.

Answer : D

Explanation

All of the above options are correct.

Q 8 - The conditional logical operators can be overloaded.

A - true

B - false

Answer : B

Explanation

The conditional logical operators cannot be overloaded.

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.

Answer : C

Explanation

Both of the above options are correct.

csharp_questions_answers.htm
Advertisements