Csharp/c#.net interview questions and answers

C#.Net interview questions for freshers
What is the difference between Finalize() and Dispose()?

Latest answer: Dispose() is called by as an indication for an object to release any unmanaged resources it has held...........
Read answer

How does the XmlSerializer work? What ACL permissions does a process using it require?

Latest answer: The XmlSerializer constructor generates a pair of classes derived from XmlSerializationReader and XmlSerializationWriter by analysis of the classes using reflection........
Read answer

Download C#.NET interview questions and answers

What are circular references? Explain how garbage collection deals with circular references.

Latest answer: A circular reference is a run-around wherein the 2 or more resources are interdependent on each other rendering the entire chain of references to be unusable........
Read answer

Explain how to add controls dynamically to the form using C#.NET.

Latest answer: The following code can be called on some event like page load or onload of some image or even a user action like onclick.......
Read answer

What are Extender provider components? Explain how to use an extender provider in the project.

Latest answer: An extender provider is a component that provides properties to other components..........
Read answer

Describe the configuration files in .Net. What are different types of configuration files in .Net framework?

Latest answer: The Machine.Config file, which specifies the settings that are global to a particular machine.......
Read answer

Describe the accessibility modifier "protected internal".

Latest answer: The Protected Internal access modifier can be accessed by:.....
Read answer

What is the difference between Debug.Write and Trace.Write? When should each be used?

Latest answer: Debug.Write: Debug Mode, Release Mode (used while debuging a project).......
Read answer

Explain the use of virtual, sealed, override, and abstract.

Latest answer: The virtual keyword enables a class to be overridden. If it has to be prevented from being overridden, then the sealed keyword needs to be used.........
Read answer

What benefit do you get from using a Primary Interop Assembly (PIA)?

Latest answer: A primary interop assembly contains type definitions (as metadata) of types implemented with COM. Only a single PIA can exist, which needs to be signed with a strong name by the publisher of the COM type library............
Read answer

Explain the use of static members with example using C#.NET.

Latest answer: Static members are not associated with a particular instance of any class.
They need to be qualified with the class name to be called.............
Read answer

How to achieve polymorphism in C#?

Latest answer: Polymorphism is when a class can be used as more than one type through inheritance. It can be used as its own type, any base types, or any interface type if it implements interfaces........
Read answer

What are implementation inheritance and interface inheritance?

Latest answer: Implementation inheritance is achieved when a class is derived from another class in such a way that it inherits all its members...........
Read answer

How to add a ReadOnly property in C#.NET?

Latest answer: Properties can be made read-only by having only a get accessor in the implementation........
Read answer

How to prevent a class from being inherited in C#.NET?

Latest answer: The sealed modifier is used to prevent derivation from a class. An error occurs if a sealed class is specified as the base class of another class.............
Read answer

What are generics in C#.NET?

Latest answer: Generic collection classes in the System.Collections.Generic namespace should be used instead of classes such as ArrayList in the System.Collections namespace............
Read answer

What is the use of GetCommandLineArgs() method in C#.NET?

Latest answer: With GetCommandLineArgs() method, the command line arguments can be accessed.
The value returned is an array of strings.............
Read answer

What is the use of System.Environment class in C#.NET?

Latest answer: The System.Environment class can be used to retrieve information like:.......
Read answer

What is the difference between const and readonly in C#.NET?

Latest answer: The read only can be modified by the class it is contained in. However, the const cannot be modified. It needs to be instantiated only at the compile time......... 
Read answer

Advantages of CLR procedure over T-SQL procedure

Latest answer: The use of the CLR procedure makes it possible to do the complex database operations without having an in-depth knowledge of T-SQL..........
Read answer

How does C#.NET Generics and C++ Templates compare?

Latest answer: C# generics and templates in C++ are more or less similar syntactically..........
Read answer

What is an object pool in .NET?

Latest answer: It is a list of ready to use objects. Whenever a new request comes in for creating an object, then the application is served from this pool. This reduces the overhead of creating an object over and over again.............
Read answer

Why is an object pool required?

Latest answer: The request for the creation of an object is served by allocating an object from the pool. This reduces the overhead of creating and re-creating objects each time an object creation is required.............
Read answer

How does object pooling and connection pooling differ?

Latest answer: In Object pooling, you can control the number of connections. In connection pooling, you can control the maximum number reached........
Read answer

Explain how to Implement an Object Pool in C#.NET.

Latest answer: using System;
using System.Collections;..........
Read answer

Describe the three major components that make up a Web Service.

Latest answer: SOAP (Simple Object Access Protocol)
UDDI (Universal Description, Discovery and Integration)
WSDL (Web Services Description Language)...........
Read answer

Explain with code sample how to Implement a Web Service in .NET.

Latest answer: C# generics are a simpler approach to parameterized types without the complexity of C++ templates In addition, C# does not attempt to provide all of the functionality that C++ templates provide...........
Read answer

What is ILDASM and Obfuscator in NET?

Latest answer: ILDASM (Intermediate Language Disassembler)
De-Compilation is the process of getting the source code from the assembly...........
Read answer

Explain how Obfuscator works in NET

Latest answer: Obfuscator simply renames all types and namespace etc to meaningless code making it non human readable. This diminishes the possibility of reverse engineering...........
Read answer

What is an Exception in .NET?

Latest answer: Exceptions are errors that occur during the runtime of a program.
The advantage of using exceptions is that the program doesn’t terminate due to the occurrence of the exception...........
Read answer

Explain how to Handle Exceptions in .NET 2.0.

Latest answer: Exceptions should never be handled by catching the general System.Exception errors, rather specific exceptions should be caught and handled....:......
Read answer

What are Custom Exceptions? Why do we need them?

Latest answer: Custom exception needs to derive from the System.Exception class. You can either derive directly from it or use an intermediate exception like SystemException or ApplicationException as base class...........
Read answer

What are delegates and why are they required?

Latest answer: Delegates are like type safe function pointers. We need delegates as they can be used to write much more generic functions which are type safe also............
Read answer

Explain how to implement Delegates in C#.NET.

Latest answer: Here is an implementation of a very simple delegate that accepts no parameters............
Read answer

CLR Triggers

Latest answer: A CLR trigger could be a Date Definition or Date Manipulation Language trigger or could be an AFTER or INSTEAD OF trigger.............
Read answer

Steps for creating CLR Trigger

Latest answer: Follow these steps to create a CLR trigger of DML (after) type to perform an insert action:.............
Read answer.

What is an assembly in .NET?

Latest answer: An assembly is the primary unit of a .NET application. It includes an assembly manifest................
Read answer

What is a Constructor? What is a Destructor?

Latest answer: It is the first method that are called on instantiation of a type. It provides way to set default values for data before the object is available for use................
Read answer

Define abstract class in C#.NET.

Latest answer: Abstract class cannot be instantiated. Same concept in C++ known as pure virtual method............
Read answer

What is serialization in .NET?

Latest answer: Serialization is a process of converting an object into a stream of bytes. .Net has 2 serializers namely XMLSerializer and SOAP/BINARY Serializer............
Read answer

C#.Net support multiple inheritance, comment

Latest answer: No, but we can use interface instead................
Read answer

Can private virtual methods be overridden in C#.NET?

Latest answer: No, moreover, you cannot access private methods in inherited classes........
Read answer

Is is possible to force garbage collector to run?

Latest answer: Yes, we can force garbage collector to run using System.GC.Collect()..........
Read answer

What is the role of data provider in ADO.NET?

Latest answer: The .NET data provider layer resides between the application and the database. Its task is to take care of all their interactions.............
Read answer

Describe how a .Net application is compiled and executed.

Latest answer: From the source code, the compiler generates Microsoft Intermediate Language (MSIL) which is further used for the creation of an EXE or DLL. The CLR processes these at runtime. Thus, compiling is the process of generating this MSIL...........
Read answer

What is an Event? Define Delegate.

Latest answer: When an action is performed, this action is noticed by the computer application based on which the output is displayed...........
Read answer

Test your C#.NET knowledge with our multiple choice questions!

What is Language Integrated Query (LINQ)?

LINQ is a set of extensions to .NET Framework that encapsulate language integrated query, set and other transformation operations..................

NET Mobile overview.

.NET Mobile is a platform for developing applications for mobile phones. It’s an extension to .NET Framework and is called Microsoft Mobile Internet Toolkit..................



Part 1 | Part 2 | Part 3 | Part 4 | part 5

Write your comment - Share Knowledge and Experience

Discussion Board
Interview FAQs on Interface in c#

Good collection of questions

find some specific questions here.


queryinngsql.com 10-29-2013 08:24 AM

c# Interview questions

Selected Interview questions http://net-informations.com/faq/net/interview-questions.htm c# interview questions


Jerry 09-11-2013 04:04 AM

About Interview-Questions and answers

The topic is helpful for me.But the way of presenting answer need to be changed.Because I
need to click on link to get complete answer.It is time waste and more.If you are trying to reduce the space you can use something like hiding and showing div or something like that. Right now it is difficult to use.

Dhanil Manuel 02-18-2013 02:16 AM

Really useful questions...

I have gone through the above questions.. those are really helpful.... I have seen a similar collection of interview questions at https://www.logicsmeet.com/forum/38554-.net-interview-questions-for-3-years-experience.aspx


Hariharan 05-16-2012 05:29 AM

More c# questions

This is really useful. Help me a lot for the preperation. The link below has very good C# Interview Questions By Topic for Junior and Senior Developers. http://www.venkatcsharpinterview.blogspot.com

Swapan 05-3-2012 10:30 AM

C#.NET Test

A new Csharp-NET test has been uploaded, check your score!

Find out where you stand. Click on the link below and take our placement practice test now!

Take test NOW!

No registration required, just practice and check your score!

Wish you good luck!

The CareerRide Team

Career 11-30-2011 02:19 AM

C#.NET Test

A new Csharp-NET test has been uploaded, check your score!

Find out where you stand. Click on the link below and take our placement practice test now!


No registration required, just practice and check your score!

Wish you good luck!

The CareerRide Team

Career 11-30-2011 02:18 AM


More interview questions on C#.NET

.NET Framework

  • Explain the features of .NET Framework
  • Describe the .Net framework architecture. Explain the components of .Net framework, i.e. Common Language Runtime, Common type system, Type safety, Manage code execution, Side-by-side execution
Common language runtime (CLR)
  • What is common language runtime? Explain the component of CLR, i.e. Class loader, MSIL, Code manager, Garbage collector, Security engine, Type checker, Thread support, Exception manager, Debug engine, COM marshaler, Base class library.
  • How the Common Language Runtime Works
Execution of .Net application
  • Explain how a .Net application is compiled and executed.
  • Explain the components to ensure secure execution of code, i.e. Assembly loader, code verifier, Just-in-compiler (JIT).
  • Explain the types of JIT compilers, i.e. Standard JIT, Pre JIT, Econo JIT.
  • Define Assembly. Explain the role that they play in the .Net framework.
  • Describe the main components of an assembly, i.e. Manifest, Type Metadata, MSIL code and Resources
  • What are the features provided by assemblies?
  • How can we view content of an assembly?
  • What are the types of assemblies? Private and shared assembly
  • Describe the global assembly cache.
.Net Technologies
  • Explain the technologies of .NET Framework 3.0.
    - Windows Presentation Foundation (WPF)
    - Windows communication Foundation
    - Windows workflow Foundation
    - Windows Cardspace
Common Type system (CTS)
  • Explain C# CTS
  • Explain the collection of CTS types defined by .NET Framework, i.e. classes, structs, enums, interfaces, delegates
  • What are type categories defined by CTS? Explain them
  • Benefit of value types.
  • Value types vs. reference types
  • What are the type conversions in C#? Explain them
  • C# 3.0 includes a new feature called an implicitly typed variable. Explain it.
.Net base class library
  • What is .Net base class library?
  • Explain the difference between value types and reference types.
Configuration and security
  • Describe the configuration files in .Net. What are different types of configuration files in .Net framework? – Machine configuration, Machine .config file, Application configuration file, security configuration file.
Boxing and unboxing
  • .NET defines value types and reference types as two major groups of data types. What are they? Explain them with example.
  • Advantages amd Disadvantage of Boxing.
C# Methods
  • Depict code to show c# methods with explanation.
  • Explain the concept of ref and out parameters with an example.
  • C# supports the use of parameter arrays and params keyword. Explain with an example
  • Using C#.Net, create a new method using input and output parameters.
  • Third type of comment supported by C# is a documentation comment. What is that?
Access Level
  • Explain the difference between public, internal and private access levels.
  • Explain the use of static members with example using C#.NET
C# user defined data type
  • Define enum. Provide an example to explain it
  • Define struct. Provide an example to explain it
C# Array
  • Explain Single dimensional arrays. Show it in an example
  • Explain Multidimensional arrays. Show it in an example
  • Explain Jagged Array. Show it in an example
  • Show how to declare a 4 by 5, two-dimensional array of ints.
  • Show how to declare a jagged two-dimensional int array in which the first dimension is 5.
  • Show how to initialize a one-dimensional int array with the values 1 through 5.
C# Object oriented programming
  • What is an object?
  • Characteristics of an object, i.e. state, behavior, identity, responsibility
  • Explain the major pillar of object oriented system, i.e. Abstraction, Encapsulation and Inheritance
  • Explain polymorphism.
  • Explain the form methods that are used to control their lifetime. Form.Show, Form.ShowDialog, Form.Activate, Form.Hide, Form.Close.
  • What are method’s events? Explain each of them, i.e. load, activate/deactivate,closing,closed.
Controls and components
  • Explain how to set the control tab order in C#.Net.
  • What is docking and anchoring. Explain their use with controls.
  • Explain how to add controls dynamically to the form using C#.NET.
  • What are Extender provider components? Explain how to use an extender provider in the project.
  • Explain how to add a control to a form at runtime.
  • What are MainMenu components? Explain its role.
  • What is ContentMenu component?
  • Write code using C#.NET for the following
    Enable or disable a menu item.
    Create shortcut keys for menu item.
    Make menu items invisible.
    Add items to a menu.
    Clone a menu
C# class
  • What is a class?
  • What are data members and function members of a C# class?
  • What are the access modifiers of the members of a class? public, private, protected, internal and protected internal
  • What is a constructor?
  • Explain the features of constructors.
  • What is a destructor? Features of destructor.
  • What are indexers?
  • Properties vs. indexers
  • Static methods of class. Example
  • non-static methods of class - Example
  • Static vs. non static methods of a class
Method overloading
  • Define Method overloading. Provide an example and explain
  • Define Operator overloading. Provide an example and explain
  • What are operators that cannot be overloaded?
  • What are rules needs to be followed while overloading operators?
  • Define Exceptions.
  • Explain System.Exception class in C#.
  • Explain the categories of exceptions that exist under the base class Exception, i.e. SystemException class, ApplicationException.
  • Explain Exception handling in C# with an example.
  • Define some of the common Exception classes in C#.
Inheritance in C#
  • Define Inheritance. Provide an example to show implemantation of inheritance in C#.
  • What are the access specifiers in base class? i.e. private, public, protected, internal and protected internal
Polymorphism in C#
  • Define Polymorphism.
  • How do we achieve Polymorphism in C#? i.e. virtual function and inheritance
  • Define Shadowing in C#. Provide an example to show implemantation of Shadowing in C#
  • Sealed class. Provide an example to show implemantation of Sealed class in C#
  • Concrete class. Provide an example to show implemantation of Concrete class in C#
  • Abstract class. Provide an example to show implemantation of Abstract class in C#
  • Interface. Provide an example to show implemantation of Interface in C#
  • Features of interfaces.
  • Abstract class vs. interface
  • Cloning in C#.
  • Concept of shallow copy or a deep copy
C# collection
  • Define collections in C#.NET.
  • Explain the types of collections - Generic collection and non-generic collection.
  • Define collection interfaces.
  • Describe some of the collection interfaces
    IEnumeration interface
  • Advantages and disadvantages of Generic and non-generic classes
C# Delegates
  • Define Delegates
  • Explain the types of Delegates - unicast delegates and multicast delegates
  • Explain the steps in defining and using delegates in C#.
  • Single vs. Multicast Delegates
  • What is Asynchronous Delegates? Provide an example to show implemantation of Asynchronous Delegates in C#
  • Define Events. Describe how to implemant of an Event in C#.
  • Explain with an example of working of Eventhandler Delegates
  • Covariance and contravariance are used to enhance the Delegate behavior. Explain it
C# garbage collector
  • Automatic memory management in .NET is done by Garbage Collector (GC). Explain
  • Brief explanation of some of the garbage collector's methods
  • Explain implicit resource management using Finalize () method
  • Explain explicit resource management using Dispose method.
C# Reflection
  • Explain Reflection C#.
  • Define the situation in which Reflection is useful.
  • Can you explain how to use different classes in system.Reflection namespace to get the types defined in the assembly?
Input/Output in C#
  • Overview of the Stream based I/O in C#.
  • Explain the types of Streams.
  • Explain how to access files paths by using the Path class.
Serialization in C#
  • Define serialization and deserialization.
  • Describe how to serialize and deserialize obect by using BinaryFormatter and SoapFormatter class.
  • Describe how to Serialize and deserialize objects by using xmlSerializer class.
  • Explain the Types of Serialization.
XML in C#
  • What is XML? Characteristics of XML. Benefit of XML
  • What are the different components of XML and explain their usage.
  • Explain the core .Net XML classes.
  • Explaination with an example the uses of XMLReader and XMLwriter for accessinbg and writing XML data.
  • Features of ADO.NET
  • Explain the components that help in data access and data manipulation in ADO.NET - .Net data provider and Dataset
  • Explain different .NET data provider
    ODBC data provider
    OLEDb data provider
    Oracle data provider
    SQL Data Provider
  • Differentiate between connected and disconnected environment.
  • Describe how to connect to SQLServer database using connection object.
  • Describe how to create and use command object to query the database.
  • Describe how to use a DataReader object to read the data fetched from the database.
  • Describe how to call a stored procedure created in SQL server database to perform insert, update or delete operations.
C# COM interoperability
  • Managed and unmanaged code
  • CLR provides two mechanisms for interoperation with unmanaged code, i.e. Platform invocation services, COM interoperability. Explain them
  • COM components vs. .NET components.
C# Multithreading
  • Define multitasking and multi-threading
  • Explain different thread states in the life cycle of a thread
  • Write a simple multithreaded application
C# web services
  • What is a web services?
  • Features of web services
  • What are the building blocks of web services?
  • Define functionality of UDDI, DISCO, WSDL and SOAP.
  • Define a web method.
  • Write a simple code to create a simple web services
  • Explain the concept of SOAP
C# deploying .NET application
  • Describe deployment process in .NET
  • What are the deployment project templates provided by VS.NET?
  • Describe how to implement XCOPY deployment.
  • What does LINQ stand for? In general terms, what is its purpose?
  • As it relates to LINQ, what interface must a data source implement?
  • What are the query keywords that begin query clauses?
  • What query keyword is used to filter a sequence? Use it to rewrite your answer to question 5 so that it returns only those MyData objects whose Height property is less than 100.
  • What query keyword orders a sequence? Using your answer for question 6, sort the results into descending order based on the Height property.
  • What query keyword groups the result of a query organized into sequences? (In other words, what keyword returns a sequence of sequences?) Show its general form.
  • What keyword joins two sequences? Show its general form in the context of a from clause.
  • When using select or group, what keyword creates a continuation?
  • What keyword creates a variable that holds a value?
  • Show how to create an instance of an anonymous type that has two string properties called Title and Author.
  • What is the lambda operator? A lambda expression is one form of anonymous function. True or False?
  • What is the query method that corresponds to the where keyword?
  • What is an extension method? How must the first parameter be declared?
  • Why are extension methods important to LINQ?

Interview questions
Latest MCQs
» General awareness - Banking » ASP.NET » PL/SQL » Mechanical Engineering
» IAS Prelims GS » Java » Programming Language » Electrical Engineering
» English » C++ » Software Engineering » Electronic Engineering
» Quantitative Aptitude » Oracle » English » Finance
Home | About us | Sitemap | Contact us