- World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.

Get it now !!
Send your Resume to 6000 Companies
C# Interview Questions & Answers - Learning Mode

C# Interview Questions & Answers - Learning Mode

C# (pronounced "C-sharp") is an object-oriented programming language from Microsoft that aims to combine the computing power of C++ with the programming ease of Visual Basic. C# is based on C++ and contains features similar to those of Java. C# is designed to work with Microsoft's .Net platform. It was developed by Microsoft within its .NET initiative and later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270:2006). C# is one of the programming languages designed for the Common Language Infrastructure. C# is a general-purpose, object-oriented programming language.

Try C# Interview Questions & Answers - Exam Mode

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Next

Sort By : Latest First | Oldest First | By Rating

C# Interview Questions & Answers - Learning Mode
Try C# Interview Questions & Answers - Exam Mode
Question: What is the name of compiler?

Answer: csc Source:
Question: what is the main difference between delegate and an event in c#?

Answer: They aren't the same. An event is an event. A "delegate" assigns a particular event handler to an object instance. Thus, when an object event happens, the proper procedure/method is called.

An example might help. I frequently code things so that a single method is called for all instances of a class. No matter which button is clicked, call my generic "button_click" method. That method will use the event arguments to determine which button was actually clicked.

In order to assig Source:
Question: Real life examples of polymorphisms, encapsulation and inheritance?

Answer: polymorphisms:-
polymorphisms is nothing but ability to take more than one forms(One Interface,Multiple Methods or One Name,Many Forms).

-is nothing but wrapping the data and functions into single entity.

The Process of deriving new class from existing class.This is called Inheritance.
New Class-Child Class
Existing Class-Parent Class

*Single Inheritance
*Hierarchic Source:
Question: What is the difference between shadow and override

Answer: Shadowing :- This is a VB.Net Concept by which you can provide a new implementation for the base class member without overriding the member. You can shadow a base class member in the derived class by using the keyword "Shadows". The method signature,access level and return type of the shadowed member can be completely different than the base class member.

Hiding : - This is a C# Concept by which you can provide a new implementation for the base class member without overriding the membe Source:
Question: What does the keyword virtual mean in the method definition?

Answer: If a base class have a virtual method it means that method must be override by the derived class using override keyword.
Question: The C# keyword int maps to which .NET type

Answer: ans:

B) System.Int32
Question: What connections does Microsoft SQL Server support?

Answer: Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords). Source:
Question: Which class use to Read/Write data to memory

Answer: Ans: MemoryStream

It is a nonbuffered stream whose encapsulated data is directly accessible in memory(RAM not files on disk).
Question: What is the C# equivalent of System.Single

Answer: Ans: Float 32 bit

e.g. float i = 6.8F; // or 6.8f

By default, a real numeric literal on the right-hand side of the assignment operator is treated as double. Therefore, to initialize a float variable use the suffix f or F.

If you don't use the suffix in the previous declaration, you will get a compilation error because you are attempting to store a double value into a float variable.
Question: XML documents for a C# program can be generated using

Answer: (B) /doc will generate xml documents
Question: What is difference between deep copy & sallow copy?

Answer: Deep Copy-In Deep Copy it copies entire page or u can say all objects while in
Shallow Copy-It Copies the some of the object Source:
Question: Does C# support multiple inheritance?

Answer: No, Instead of this, we can inheritance the multiple interface,

but C++ support multiple inheritance
Question: Which tool is used to browse the classes, structs, interfaces etc. in the BCL?

Answer: wincv as in Windows Class View
Question: How we hand sql exceptions? What is the class that handles SqlServer exceptions?

Answer: SqlExceptionclass is created whenever the .NET Framework Data Provider for SQL Server encounters an error generated from the server. (Client side errors are thrown as standard common language runtime exceptions.) SqlException always contains at least one instance of SqlError.


catch (SqlException e)
string errorMessages = "";

for (int i=0; i < e.Errors.Count; i++)
Question: What is an object?Define a class.

Answer: Object is an instance to call the methods and properties of the class. Source:
Question: Application Isolation is assured using

Answer: ans:

C) ApplicationDomain
Question: What is partial class. & what is advantage.

Answer: Partial Class is spilt UI Logic and Business logic in separate files.
Multiples developers can work on the same class file.
At the compilation time it will treat as single file by it class name.
Question: Define abstraction,encapsulation,inheritance:with example.

Answer: Abstraction : Abstraction works by abstracting common parts of objects and merging them into a single abstract class. An abstract class is a parent class that allows inheritance but can never be instantiated. Abstract classes contain one or more abstract methods that do not have implementation. Abstract classes allow specialization of inherited classes.

Encapsulation :The details of how objects worked are hidden to the user of that object.Like RGB colors.We define RGB internally what happ Source:
Question: How do you choose 1 entry point when C# project has more Main( ) method?

Answer: In one .cs file there may be many classes having Main() method. While making the .exe you can define the class name as an entry point

CSC /main:classname filename.cs
Question: There can me more than 1 Main() functions in a C# program

Answer: It is possible to have multiple Main() methods in C# program. But, you have to explicitly identify which Main method is the entry point at the run-time. C++ and Java Programmers, take note that Main starts with capital 'M' and the return type is void.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Next

India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.03125 Seconds