- 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 IV
Q 1 - Dynamic polymorphism is implemented by abstract classes and virtual functions.
Answer : A
Explanation
Dynamic polymorphism is implemented by abstract classes and virtual functions.
Answer : A
Explanation
The comparison operators can be overloaded.
Answer : B
Explanation
The conditional logical operators cannot be overloaded.
Answer : A
Explanation
The assignment operators cannot be overloaded.
Q 5 - Which of the following is the correct about interfaces in C#?
A - Interfaces are declared using the interface keyword.
Answer : C
Explanation
Both of the above options are correct.
Q 6 - Which of the following is the correct about namespaces in C#?
A - A namespace is designed for providing a way to keep one set of names separate from another.
C - The using keyword states that the program is using the names in the given namespace.
Answer : D
Explanation
All of the above options are correct.
Answer : A
Explanation
You can define one namespace inside another namespace. You can access members of nested namespace by using the dot (.) operator.
Q 8 - Which of the following preprocessor directive defines a sequence of characters as symbol in C#?
Answer : A
Explanation
#define: It defines a sequence of characters, called symbol.
Q 9 - Which of the following preprocessor directive allows you to undefine a symbol in C#?
Answer : B
Explanation
#undef: It allows you to undefine a symbol.
Q 10 - Which of the following preprocessor directive allows testing a symbol or symbols to see if they evaluate to true in C#?
Answer : C
Explanation
#if − It allows testing a symbol or symbols to see if they evaluate to true.
Q 11 - Which of the following preprocessor directive allows to create a compound conditional directive, along with #if in C#?
Answer : D
Explanation
#else − It allows to create a compound conditional directive, along with #if.
Q 12 - Which of the following preprocessor directive allows creating a compound conditional directive in C#?
Answer : A
Explanation
#elif − It allows creating a compound conditional directive.
Q 13 - Which of the following preprocessor directive specifies the end of a conditional directive in C#?
Answer : B
Explanation
#endif − Specifies the end of a conditional directive.
Q 14 - Which of the following preprocessor directive lets you modify the compiler's line number and (optionally) the file name output for errors and warnings in C#?
Answer : C
Explanation
#line − It lets you modify the compiler's line number and (optionally) the file name output for errors and warnings.
Q 15 - Which of the following preprocessor directive allows generating an error from a specific location in your code in C#?
Answer : D
Explanation
#error − It allows generating an error from a specific location in your code.
Q 16 - Which of the following preprocessor directive allows generating a level one warning from a specific location in your code in C#?
Answer : A
Explanation
#warning − It allows generating a level one warning from a specific location in your code.
Q 17 - Which of the following preprocessor directive lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor in C#?
Answer : B
Explanation
#region − It lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor.
Q 18 - Which of the following preprocessor directive marks the end of a #region block in C#?
Answer : C
Explanation
#endregion − It marks the end of a #region block.
Q 19 - Which of the following is true about try block in C#?
A - A try block identifies a block of code for which particular exceptions is activated.
Answer : C
Explanation
Both of the above options are correct.
Q 20 - Which of the following is true about catch block in C#?
B - The catch keyword indicates the catching of an exception.
Answer : C
Explanation
Both of the above options are correct.
Q 21 - The finally block is used to execute a given set of statements, whether an exception is thrown or not thrown.
Answer : A
Explanation
The finally block is used to execute a given set of statements, whether an exception is thrown or not thrown.
Q 22 - Which of the following is true about exceptions in C#?
Answer : C
Explanation
Both of the above options are correct.
Q 23 - Which of the following is true about System.ApplicationException class in C#?
A - The System.ApplicationException class supports exceptions generated by application programs.
B - Exceptions defined by the programmers should derive from this class.
Answer : C
Explanation
Both of the above options are correct.
Q 24 - The System.SystemException class is the base class for all predefined system exception in C#?
Answer : A
Explanation
The System.SystemException class is the base class for all predefined system exception.
Q 25 - User-defined exception classes are derived from the ApplicationException class in C#?
Answer : A
Explanation
User-defined exception classes are derived from the ApplicationException class.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | A |
2 | A |
3 | B |
4 | A |
5 | C |
6 | D |
7 | A |
8 | A |
9 | B |
10 | C |
11 | D |
12 | A |
13 | B |
14 | C |
15 | D |
16 | A |
17 | B |
18 | C |
19 | C |
20 | C |
21 | A |
22 | C |
23 | C |
24 | A |
25 | A |
To Continue Learning Please Login
Login with Google