C# Mock Test



This section presents you various set of Mock Tests related to C#. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

C# Mock Test I

Answer : D

Explanation

All of the above options are correct.

Q 3 - Which of the following keyword is used for including the namespaces in the program in C#?

A - imports

B - using

C - exports

D - None of the above.

Answer : B

Explanation

The using keyword is used for including the namespaces in the program.

Answer : C

Explanation

Both of the above options are correct.

Answer : C

Explanation

Both of the above options are correct.

Q 6 - 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 7 - Which of the following is a contextual keyword in C#?

A - get

B - set

C - add

D - All of the above.

Answer : D

Explanation

All of the above options are contextual keywords.

Q 8 - We can use reserved keywords as identifiers in C#?

A - true

B - false

Answer : B

Explanation

Keywords are reserved words predefined to the C# compiler. These keywords cannot be used as identifiers.

Q 9 - 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 10 - Which of the following variable types can be assigned a value directly in C#?

A - Value types

B - Reference types

C - Pointer types

D - All of the above.

Answer : A

Explanation

Value type variables can be assigned a value directly.

Q 11 - 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.

Answer : D

Explanation

All of the above options are correct.

Answer : A

Explanation

When a value type is converted to object type, it is called boxing.

Answer : B

Explanation

When an object type is converted to a value type, it is called unboxing.

Answer : C

Explanation

Both of the above options are correct.

Q 18 - 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 19 - Which of the following converts a type to a byte value in C#?

A - ToSingle

B - ToByte

C - ToChar

D - ToDateTime

Answer : B

Explanation

ToByte() method converts a type to a byte.

Q 20 - Which of the following converts a type to a single Unicode character, where possible in C#?

A - ToSingle

B - ToByte

C - ToChar

D - ToDateTime

Answer : C

Explanation

ToChar() method converts a type to a single Unicode character, where possible.

Q 21 - 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 22 - Which of the following converts a floating point or integer type to a decimal type in C#?

A - ToDecimal

B - ToDouble

C - ToInt16

D - ToInt32

Answer : A

Explanation

ToDecimal() method converts a floating point or integer type to a decimal type.

Q 23 - Which of the following converts a type to a double type in C#?

A - ToDecimal

B - ToDouble

C - ToInt16

D - ToInt32

Answer : B

Explanation

ToDouble() method converts a type to a double type.

Q 24 - 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 25 - Which of the following converts a type to a 32-bit integer in C#?

A - ToDecimal

B - ToDouble

C - ToInt16

D - ToInt32

Answer : D

Explanation

ToInt32() method converts a type to a 32-bit integer.

Answer Sheet

Question Number Answer Key
1 D
2 D
3 B
4 C
5 C
6 D
7 D
8 B
9 A
10 A
11 A
12 D
13 D
14 D
15 A
16 B
17 C
18 A
19 B
20 C
21 D
22 A
23 B
24 C
25 D
csharp_questions_answers.htm
Advertisements