Join Our Email Alerts-Subscribe
Important Note:Login & Check Your Email Inbox and Activate Confirmation Link

Enter Your Email :

Copyright Disclaimer:
Section 107 of the Copyright Act Fair Use Contents .
We are forwarding content link(s) from our website to content website & We are not serving any contents.
Main the Content PDF link(s) is/are obtained from GoogleSearch
for the purpose of Education & Teaching Intention. Not for commercial purpose. is not liable/responsible for any copyright issues.

C# Materials Free Download

) What are the different types of classes in C#?

Ans: The different types of class in C# are:

• Partial class – Allows its members to be divided or shared with multiple .cs files. It is denoted by the keyword Partial. 

• Sealed class – It is a class which cannot be inherited. To access the members of a sealed class, we need to create the object of the class. It is denoted by the keyword Sealed. 

• Abstract class – It is a class whose object cannot be instantiated. The class can only be inherited. It should contain at least one method. It is denoted by the keyword abstract. 

• Static class – It is a class which does not allow inheritance. The members of the class are also static. It is denoted by the keyword static. This keyword tells the compiler to check for any accidental instances of the static class. 

Q #6) Explain Code compilation in C#.

Ans: There are four steps in code compilation which include:

• Compiling the source code into Managed code by C# compiler.

• Combining the newly created code into assemblies.

• Loading the Common Language Runtime(CLR).

• Executing the assembly by CLR.

What is the difference between Virtual method and Abstract method?

Ans: A Virtual method must always have a default implementation. However, it can be overridden in the derived class, though not mandatory. It can be overridden using override keyword. 

An Abstract method does not have an implementation. It resides in the abstract class. It is mandatory that the derived class implements the abstract method. An override keyword is not necessary here though it can be used. 

Q #9) Explain Namespaces in C#.

Ans: They are used to organize large code projects. “System” is the most widely used namespace in C#. We can create our own namespace and use one namespace in another, which are called Nested Namespaces. 

They are denoted by the keyword “namespace”.

Q #10) What is “using” statement in C#?

Ans: “Using” Keyword denotes that the particular namespace is being used by the program.

For Example, using System. Here System is a namespace. The class Console is defined under System. So we can use the console.writeline (“….”) or readline in our program. 

Q #11) Explain Abstraction.

Ans: Abstraction is one of the OOP concepts. It is used to display only the essential features of the class and hides the unnecessary information. 

Let us take an Example of a Car: 

A driver of the car should know the details about the Car such as color, name, mirror, steering, gear, brake, etc. What he doesn’t have to know is an Internal engine, Exhaust system. 

So, Abstraction helps in knowing what is necessary and hiding the internal details from the outside world. Hiding of the internal information can be achieved by declaring such parameters as Private using the private keyword. 

Q #12) Explain Polymorphism?

Ans: Programmatically, Polymorphism means same method but different implementations.

It is of 2 types, Compile-time and Runtime.

Compile time polymorphism is achieved by operator overloading.

Runtime polymorphism is achieved by overriding. Inheritance and Virtual functions are used during Runtime Polymorphism. 

For Example, If a class has a method Void Add(), polymorphism is achieved by Overloading the method, that is, void Add(int a, int b), void Add(int add) are all overloaded methods. 

Q #13) How is Exception Handling implemented in C#?

Ans: Exception handling is done using four keywords in C#:

• try – Contains a block of code for which an exception will be checked.

• catch – It is a program that catches an exception with the help of exception handler.

• finally – It is a block of code written to execute regardless whether an exception is caught or not.

• Throw – Throws an exception when a problem occurs.

Q #14) What are C# I/O Classes? What are the commonly used I/O Classes?

Ans: C# has System.IO namespace, consisting of classes that are used to perform various operations on files like creating, deleting, opening, closing etc. 

Some commonly used I/O classes are:

• File – Helps in manipulating a file.

• StreamWriter – Used for writing characters to a stream.

• StreamReader – Used for reading characters to a stream.

• StringWriter – Used for reading a string buffer.

• StringReader – Used for writing a string buffer.

• Path – Used for performing operations related to path information.

Q #15) What is StreamReader/StreamWriter class?

Ans: StreamReader and StreamWriter are classes of namespace System.IO. They are used when we want to read or write charact90, Reader-based data, respectively. 

Some of the members of StreamReader are: Close(), Read(), Readline().

Members of StreamWriter are: Close(), Write(), Writeline().

Class Program1


using(StreamReader sr = new StreamReader(“C:\ReadMe.txt”)


//----------------code to read-------------------//


using(StreamWriter sw = new StreamWriter(“C:\ReadMe.txt”))


//-------------code to write-------------------//



Q #16) What is a Destructor in C#?

Ans: A Destructor is used to clean up the memory and free the resources. But in C# this is done by the garbage collector on its own. System.GC.Collect() is called internally for cleaning up. But sometimes it may be necessary to implement destructors manually. 

For Example:





Q #17) What is an Abstract Class?

Ans: An Abstract class is a class which is denoted by abstract keyword and can be used only as a Base class. An Abstract class should always be inherited. An instance of the class itself cannot be created. If we do not want any program to create an object of a class, then such classes can be made abstract. 

Any method in the abstract class does not have implementations in the same class. But they must be implemented in the child class. 

For Example:

abstract class AB1


Public void Add();


Class childClass : AB1


childClass cs = new childClass ();

int Sum = cs.Add();


All the methods in an abstract class are implicitly virtual methods. Hence virtual keyword should not be used with any methods in abstract class. 

Q #18) What are Boxing and Unboxing?

Ans: Converting a value type to reference type is called Boxing.

For Example: 

int Value1 -= 10;


object boxedValue = Value1;

Explicit conversion of same reference type (created by boxing) back to value type is called Unboxing.

For Example:


int UnBoxing = int (boxedValue);

Q #19) What is the difference between Continue and Break Statement?

Ans: Break statement breaks the loop. It makes the control of the program to exit the loop. Continue statement makes the control of the program to exit only the current iteration. It does not break the loop. 

Q #20) What is the difference between finally and finalize block?

Ans: finally block is called after the execution of try and catch block. It is used for exception handling. Regardless of whether an exception is caught or not, this block of code will be executed. Usually, this block will have clean-up code. 

finalize method is called just before garbage collection. It is used to perform clean up operations of Unmanaged code. It is automatically called when a given instance is not subsequently called. 

Questions on Arrays and Strings

Q #21) What is an Array? Give the syntax for a single and multi-dimensional array?

Ans: An Array is used to store multiple variables of the same type. It is a collection of variables stored in a contiguous memory location. 

For Example:

double numbers = new double[10];

int[] score = new int[4] {25,24,23,25};

A Single dimensional array is a linear array where the variables are stored in a single row. Above example is a Single dimensional array. 

Arrays can have more than one dimension. Multidimensional arrays are also called rectangular arrays.

For Example, int[,] numbers = new int[3,2] { {1,2} ,{2,3},{3,4} };

Q #22) What is a Jagged Array?

Ans: A Jagged array is an array whose elements are arrays. It is also called as the array of arrays. It can be either single or multiple dimensions. 

int[] jaggedArray = new int[4][];

Q #23) Name some properties of Array.

Ans: Properties of an Array include:

• Length – Gets the total number of elements in an array.

• IsFixedSize – Tells whether the array is fixed in size or not.

• IsReadOnly – Tells whether the array is read-only or not.

Q #24) What is an Array Class?

Ans: An Array class is the base class for all arrays. It provides many properties and methods. It is present in the namespace System. 

Q #25) What is a String? What are the properties of a String Class?

Ans: A String is a collection of char objects. We can also declare string variables in c#.

string name = “C# Questions”;

A string class in C# represents a string.

The properties of String class are Chars and Length.

Chars get the Char object in the current String.

Length gets the number of objects in the current String.

Q #26) What is an Escape Sequence? Name some String escape sequences in C#.

Ans: An Escape sequence is denoted by a backslash (\). The backslash indicates that the character that follows it should be interpreted literally or it is a special character. An escape sequence is considered as a single character. 

String escape sequences are as follows:

\n – Newline character

\b – Backspace

\\ – Backslash

\’ – Single quote

\’’ – Double Quote

Source: Contents are provided by Technicalsymposium Google Group Members. 
Disclaimer: All the above contents are provided by Google Group members. 
Further, this content is not intended to be used for commercial purpose. is not liable/responsible for any copyright issues.

Download Technical Interview Materials PDF-Free Download

Technical Interview Questions and Answers Notes PDF
Placement Materials PDF-Free Download Study Materials PDF-Free Download Live Support-Chat with Our Experts

Official Contact: +91-9245556793 (Whatsapp Message / SMS / Voice Call)

Our Expert team is ready to answer all your questions immediately-Feel free to speak in Tamil/English.

(Example:Events info/Lecture Notes/Off-Campus & All Jobs/Projects & All education information)

Working hrs (IST): (Morning: 10:00AM-3:00 PM) and (Evening:5:00 PM to 10:00 PM)

All Latest Question & Answer Page (FAQ)-Click here