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

A - ToType

B - ToSbyte

C - ToSingle

D - ToString

Answer : A

Explanation

ToType() method converts a type to a specified type.

Q 4 - Which of the following operator represents a conditional operation in C#?

A - ?:

B - is

C - as

D - *

Answer : A

Explanation

?: operator represents a conditional operation.

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 function?

A - Private

B - Public

C - Protected

D - Internal

Answer : A

Explanation

Default access for the class member function is Private.

Q 8 - The assignment operators cannot be overloaded.

A - true

B - false

Answer : A

Explanation

The assignment operators cannot 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.

Q 10 - Which of the following preprocessor directive lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor in C#?

A - warning

B - region

C - line

D - error

Answer : B

Explanation

#region − It lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor.


csharp_questions_answers.htm

Advertisements