C# Mock Test


Advertisements

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 II

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

A - ToInt64

B - ToSbyte

C - ToSingle

D - ToInt32

Answer : A

Explanation

ToInt64() method converts a type to a 64-bit integer.

Q 2 - Which of the following converts a type to a signed byte type in C#?

A - ToInt64

B - ToSbyte

C - ToSingle

D - ToInt32

Answer : B

Explanation

ToSbyte() method converts a type to a signed byte type.

Q 3 - Which of the following converts a type to a small floating point number in C#?

A - ToInt64

B - ToSbyte

C - ToSingle

D - ToInt32

Answer : C

Explanation

ToSingle() method converts a type to a small floating point number.

Q 4 - 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 5 - 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 6 - Which of the following converts a type to an unsigned int type in C#?

A - ToType

B - ToUInt16

C - ToSingle

D - ToString

Answer : B

Explanation

ToUInt16() method converts a type to an unsigned int type.

Q 7 - 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 8 - Which of the following converts a type to an unsigned big type in C#?

A - ToType

B - ToUInt16

C - ToUInt32

D - ToUInt64

Answer : D

Explanation

ToUInt64() method converts a type to an unsigned big type.

Q 9 - Which of the following operator returns the size of a data type in C#?

A - sizeof

B - typeof

C - &</a>

D - *

Answer : A

Explanation

sizeof() operator returns the size of a data type.

Q 10 - Which of the following operator returns the type of a class in C#?

A - sizeof

B - typeof

C - &</a>

D - *

Answer : B

Explanation

typeof() operator returns the type of a class.

Q 11 - Which of the following operator returns the address of an variable in C#?

A - sizeof

B - typeof

C - &

D - *

Answer : C

Explanation

& operator returns the address of an variable.

Q 12 - Which of the following operator creates a pointer to a variable in C#?

A - sizeof

B - typeof

C - &

D - *

Answer : D

Explanation

* operator creates a pointer to a variable.

Q 13 - 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 14 - 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 15 - 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.

Answer : C

Explanation

Both of the above statements are correct.

Q 18 - 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 19 - Which of the following access specifier in C# allows a class to hide its member variables and member functions from other functions and objects?

A - Public

B - Private

C - Protected

D - Internal

Answer : B

Explanation

Private access specifier allows a class to hide its member variables and member functions from other functions and objects.

Q 20 - 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 21 - Which of the following access specifier in C# allows a class to expose its member variables and member functions to other functions and objects in the current assembly?

A - Public

B - Private

C - Protected

D - Internal

Answer : D

Explanation

Internal access specifier allows a class to expose its member variables and member functions to other functions and objects in the current assembly.

Q 22 - 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 23 - 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 24 - Which of the following method copies the reference to the memory location of an argument into the formal parameter?

A - Value parameters

B - Reference parameters

C - Output parameters

D - None of the above.

Answer : B

Explanation

Reference parameters method copies the reference to the memory location of an argument into the formal parameter.

Q 25 - Which of the following method helps in returning more than one value?

A - Value parameters

B - Reference parameters

C - Output parameters

D - None of the above.

Answer : C

Explanation

Output parameters method helps in returning more than one value.

Answer Sheet

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