- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
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.
C# Mock Test III
Q 1 - Which of the following is correct about nullable types in C#?
B - You can assign true, false, or null in a Nullable<bool> variable.
Answer : D
Explanation
All of the above statements are correct.
Q 2 - Which of the following is correct about null coalescing operator in C#?
A - The null coalescing operator is used with the nullable value types and reference types.
Answer : D
Explanation
All of the above statements are correct.
Q 3 - Which of the following is correct about params in C#?
B - Additional parameters are not permitted after the params keyword in a method declaration.
C - Only one params keyword is allowed in a method declaration.
Answer : D
Explanation
All of the above statements are correct.
Q 4 - Which of the following property of Array class in C# checks whether the Array has a fixed size?
Answer : A
Explanation
IsFixedSize gets a value indicating whether the Array has a fixed size.
Q 5 - Which of the following property of Array class in C# checks whether the Array is readonly?
Answer : B
Explanation
IsReadOnly gets a value indicating whether the Array is readonly.
Q 6 - Which of the following property of Array class in C# gets a 32-bit integer, the total number of elements in all the dimensions of the Array?
Answer : C
Explanation
Length gets a 32-bit integer that represents the total number of elements in all the dimensions of the Array.
Q 7 - 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?
Answer : B
Explanation
LongLength gets a 64-bit integer that represents the total number of elements in all the dimensions of the Array.
Q 8 - Which of the following property of Array class in C# gets the rank (number of dimensions) of the Array?
Answer : A
Explanation
Rank gets the rank (number of dimensions) of the Array.
Q 9 - Which of the following is true about C# structures?
A - Structures can have methods, fields, indexers, properties, operator methods, and events.
B - Structures can have defined constructors, but not destructors.
Answer : D
Explanation
All of the above options are correct.
Q 10 - Which of the following is true about C# structures?
A - Unlike classes, structures cannot inherit other structures or classes.
B - Structure members cannot be specified as abstract, virtual, or protected.
Answer : D
Explanation
All of the above options are correct.
Q 11 - Which of the following is true about C# structures vs C# classes?
A - Classes are reference types and structs are value types.
B - Structures do not support inheritance.
Answer : D
Explanation
All of the above options are correct.
Q 12 - Which of the following is true about C# enumeration?
A - An enumerated type is declared using the enum keyword.
B - C# enumerations are value data type.
C - Enumeration contains its own values and cannot inherit or cannot pass inheritance.
Answer : D
Explanation
All of the above options are correct.
Q 13 - Which of the following is the default access specifier of a class?
Answer : D
Explanation
Default access specifier for a class type is Internal.
Q 14 - Which of the following is the default access specifier of a class member variable?
Answer : A
Explanation
Default access for the class member variables is Private.
Q 15 - Which of the following is the default access specifier of a class member function?
Answer : A
Explanation
Default access for the class member function is Private.
Q 16 - Which of the following is the correct about class member functions?
Answer : C
Explanation
Both of the above options are correct.
Q 17 - Which of the following is the correct about class member variables?
B - These private variables can only be accessed using the public member functions.
Answer : C
Explanation
Both of the above options are correct.
Q 18 - Which of the following is the correct about class constructor?
B - A constructor has exactly the same name as that of class and it does not have any return type.
Answer : C
Explanation
Both of the above options are correct.
Q 19 - Which of the following is the correct about class destructor?
Answer : C
Explanation
Both of the above options are correct.
Q 20 - Which of the following is the correct about static member variables of a class?
A - We can define class members variables as static using the static keyword.
Answer : C
Explanation
Both of the above options are correct.
Q 21 - Which of the following is the correct about static member functions of a class?
A - You can also declare a member function as static.
B - Such functions can access only static variables.
C - The static functions exist even before the object is created.
Answer : D
Explanation
All of the above options are correct.
Answer : B
Explanation
C# does not support multiple inheritance.
Answer : A
Explanation
C# does not support multiple inheritance.
Answer : A
Explanation
Function overloading is a kind of static polymorphism.
Answer : B
Explanation
Opeator overloading is a kind of static polymorphism.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | D |
2 | D |
3 | D |
4 | A |
5 | B |
6 | C |
7 | B |
8 | A |
9 | D |
10 | D |
11 | D |
12 | D |
13 | D |
14 | A |
15 | A |
16 | C |
17 | C |
18 | C |
19 | C |
20 | C |
21 | D |
22 | B |
23 | A |
24 | A |
25 | B |