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

A - abstract

B - as

C - foreach

D - All of the above.

Answer : D

Explanation

All of the above options are reserved keywords.

Q 3 - Which of the following converts a type to a 16-bit integer in C#?

A - ToDecimal

B - ToDouble

C - ToInt16

D - ToInt32

Answer : C

Explanation

ToInt16() method converts a type to a 16-bit integer.

Q 4 - Which of the following operator casts without raising an exception if the cast fails in C#?

A - ?:

B - is

C - as

D - *

Answer : C

Explanation

as operator casts without raising an exception if the cast fails.

Q 5 - Which of the following access specifier in C# allows a class to hide its member variables and member functions from other class objects and functions, except a child class within the same application?

A - Protected Internal

B - Private

C - Protected

D - Internal

Answer : A

Explanation

Protected Internal access specifier allows a class to hide its member variables and member functions from other class objects and functions, except a child class within the same application.

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 8 - C# supports multiple inheritance.

A - true

B - false

Answer : B

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.

Answer : C

Explanation

Both of the above options are correct.


csharp_questions_answers.htm

Advertisements