- 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
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 I
Q 1 - Which of the following is correct about C#?
A - C# is a modern, general-purpose, object-oriented programming language developed by Microsoft.
B - C# was developed by Anders Hejlsberg and his team during the development of .Net Framework.
C - C# is designed for Common Language Infrastructure (CLI).
Answer : D
Explanation
All of the above options are correct.
Q 2 - Which of the following is correct about C#?
B - It can be compiled on a variety of computer platforms.
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#?
Answer : B
Explanation
The using keyword is used for including the namespaces in the program.
Q 4 - Which of the following is correct about variable naming conventions in C#?
Answer : C
Explanation
Both of the above options are correct.
Q 5 - Which of the following is correct about variable naming conventions in C#?
A - It should not be a C# keyword.
B - It must not contain any embedded space or symbol such as? - + ! @ # % ^ & * ( ) [ ] { }
Answer : C
Explanation
Both of the above options are correct.
Q 6 - Which of the following is a reserved keyword in C#?
Answer : D
Explanation
All of the above options are reserved keywords.
Q 7 - Which of the following is a contextual keyword in C#?
Answer : D
Explanation
All of the above options are contextual keywords.
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?
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#?
Answer : A
Explanation
Value type variables can be assigned a value directly.
Answer : A
Explanation
Value type variables in C# are derived from the class System.ValueType.
Q 12 - Which of the following is correct about value type variables in C#?
A - The value types directly contain data.
C - When you declare an int type, the system allocates memory to store the value.
Answer : D
Explanation
All of the above options are correct.
Q 13 - Which of the following is correct about reference type variables in C#?
A - The reference types do not contain the actual data stored in a variable.
B - They contain a reference to the variables.
C - Example of built-in reference types are: object, dynamic, and string.
Answer : D
Explanation
All of the above options are correct.
Q 14 - Which of the following is correct about Object Type in C#?
A - The Object Type is the ultimate base class for all data types in C# Common Type System (CTS).
Answer : D
Explanation
All of the above options are correct.
Q 15 - Which of the following defines boxing correctly?
A - When a value type is converted to object type, it is called boxing.
B - When an object type is converted to a value type, it is called boxing.
Answer : A
Explanation
When a value type is converted to object type, it is called boxing.
Q 16 - Which of the following defines unboxing correctly?
A - When a value type is converted to object type, it is called unboxing.
B - When an object type is converted to a value type, it is called unboxing.
Answer : B
Explanation
When an object type is converted to a value type, it is called unboxing.
Q 17 - Which of the following is correct about dynamic Type in C#?
A - You can store any type of value in the dynamic data type variable.
B - Type checking for these types of variables takes place at run-time.
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#?
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#?
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#?
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#?
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#?
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#?
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#?
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#?
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 |