C # Interview Questions for Freshers and Experienced – Frequently Asked

Table of Content : here
Goto Category C# : here

Q. What is OOPS (object oriented programming) in C# ?
Ans. Object oriented programing (OOP) is a programming paradigm which is based on Objects. They may contain data in the form of fields and methods (procedures). Objects are usually instances of Classes, which are used to interact with each other therefore gaining reusability and modularity. Read more

Q. What are Sealed Classes in C# ?
Ans. Sealed Classes are the classes that cannot be inherited. It restrict Inheritance, you cannot use it as a base class. It is define with the help of ‘sealed’ keyword. Read more

Q. What is Interface in C# ?
Ans. Interface is a set of similar functionalities that can be implemented by a class or struct. You can think it as a contract in which it is said that any class or struct that is implementing it must provide implementation of all the methods, properties, indexers and events, declared in it. Read more

Q. What is Abstract Class in C# ?
Ans. Abstract Classes are the classes that contain abstract fields – methods / properties(only declaration) or non abstract methods(with definition). They are created with the help of abstract keyword. The abstract methods do not provide any concrete definition but required a derived class to implement its abstract methods. Read more

Q. What is Generics in C# ?
Ans. Dictionary meaning of Generics is General. So in Generics we are generalizing the types either they are class, methods, interfaces etc. While creating class or other types we are not restricting its data type, it is defined at the time of instantiating according to the requirement. Read more

Q. What are Extension Methods in C# ?
Ans. Extension Methods are introduced in C# 3.0. These methods are used to extend the functionalities of existing classes and for that there is no need to modify, extend or recompile the existing class. Read more

Q. IEnumerable vs IQueryable in LINQ – C# ?
Ans. IEnumerable vs IQueryable both are used to query data from Database and Collections. But how they deal a query is the thing that makes them different. Read more.

Q. What is the difference between throw and throw ex in C# ?
Ans. throw and throw ex both are used to throw an Exception. We can also re-throw an Exception. Throw passes the exception to its caller. The caller can then have the chance to do something with that exception. Read more.

Q. What is Publisher and Subscriber Pattern in C# with Event and Delegate ?
Ans. Publisher / Subscriber is a Pattern where a Publisher can raise an event and all the subscribers are get notified. Usually useful while broadcasting.Read more.

Q. What is Garbage Collection in C# ?
Ans. Garbage Collector is an automatic memory manager. It frees the memory occupied by objects which are no longer in use by the application. It works well in the managed heap. Read more.

Q. What is Reflection in C# ?
Ans. Reflection is a namespace which provides objects that encapsulate assemblies, modules and types. The objects are of type ‘Type’ (System.Type). With the help of these objects, we can obtain information about the loaded assemblies and the types defined in them (they can be class, struct, interface, methods etc) by accessing their metadata. With the help of reflection you can also create instance of any type dynamically, bind it to any existing object (i.e, late binding), can call its methods, or can access its fields and properties, and attributes etc. Read more.

Q. Difference between Interface and Abstract class in C# ?
Ans. Abstract Classes are the classes that contain abstract fields – methods / properties(only declaration) or non abstract methods(with definition). They are created with the help of ‘abstract’ keyword. Read more.

Q. What is the difference between Structure and Class in C# ?
Ans. Classes and Structure both are the essential data structure that binds the logically related data (or behavior) to a unit. But they are quiet different from each other. Find out How.

Q. Difference between Constant and ReadOnly Variables in C# ?
Ans. Constant variables are defined at the time of declaration whereas ReadOnly variables can be defined at declaration time or in constructor Read more.

Q. Difference between var and dynamic keywords in C# ?
Ans. Datatype of var keyword is decided at compile time whereas Datatype of Dynamic keyword is decided at runtime. Read more.

Q. Difference between Static and Singleton Class in C# ?
Ans. In Static Class, Instances cannot be created Whereas Only one instance is created of a Singleton class in the class itself. Read more.

Q. Difference between ArrayList and List in C# ?
Ans. ArrayList are not strongly typed Whereas List are strongly typed. Read more.

Q. Difference Between Array and ArrayList in C# ?
Ans. Array are strongly typed means their datatype is known at compile time Whereas ArrayLists are not strongly typed, they can store value of any datatype. Read more.

Q. Difference between Dictionary and Hashtable in C#?
Ans. Dictionary is a generic type which means we can use it with any data type Whereas Hashtable is not a generic type. Read more

Q. What is Constructor chaining?
Q. Write a program to reverse a string without using any built-in function or array.
Q. What is the difference between Stack and Heap?
Q. What is the difference between Boxing and Unboxing?
Q. Explain the difference between overloading and overriding.
Q. Can you create object of Abstract class?
Q. You have an abstract class A. B class is derived from A. Now when you create the object of class B,
does that call the base class object first. (Later asked – If yes – how we can’t create the object of abstract class. If No – Why?)

Q. Can we force GC to run? How ?
Q. Where do string store in memory?
Q. You must know about virtual methods. So do we have virtual Properties and events also?
Q. What is static binding and static linking? Are they same or different?
Q. What are the types of Polymorphism.
Q. What are anonymous types? (Not talking about anonymous methods.)

Leave a Reply

Your email address will not be published. Required fields are marked *