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 - Value type variables in C# are derived from the class System.ValueType?

A - true

B - false

Answer : A

Explanation

Value type variables in C# are derived from the class System.ValueType.

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 access specifier in C# allows a class to expose its member variables and member functions to other functions and objects?

A - Public

B - Private

C - Protected

D - Internal

Answer : A

Explanation

Public access specifier allows a class to expose its member variables and member functions to other functions and objects.

Q 6 - Which of the following property of Array class in C# gets a 64-bit integer, the total number of elements in all the dimensions of the Array?

A - Rank

B - LongLength

C - Length

D - None of the above.

Answer : B

Explanation

LongLength gets a 64-bit integer that represents the total number of elements in all the dimensions of the Array.

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.

Answer : C

Explanation

Both of the above options are correct.

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