- 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 II
Q 1 - Which of the following converts a type to a 64-bit integer in C#?
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#?
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#?
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#?
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#?
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#?
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#?
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#?
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#?
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#?
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#?
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#?
Answer : D
Explanation
* operator creates a pointer to a variable.
Q 13 - Which of the following operator represents a conditional operation in C#?
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#?
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#?
Answer : C
Explanation
as operator casts without raising an exception if the cast fails.
Q 16 - Which of the following statements is correct about encapsulation?
Answer : D
Explanation
All of the above statements are correct.
Q 17 - Which of the following statements is correct about access specifiers in C#?
A - Encapsulation is implemented by using access specifiers.
B - An access specifier defines the scope and visibility of a class member.
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?
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?
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?
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?
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?
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?
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?
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?
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 |