Hello guys, this post is about the interview questions that are asked by most of the interviewers. It contains beginners to expert level questions. I have collected these questions from multiple websites and some personal experiences. Hope you will like this post.
Interview questions over this blog post is also good click here to view.
- benefit of linq
- example ref and out.
- difference between Application object and session object and temp data
- difference between Iqueryable ,Ienum and Icollection.
- difference API response based on platform. (eg: mobile device: Json nd web app: xml)
- what are the serializer for json and xml.
- deferred object in angular
- services and factory in angular
- State Management Techniques
- Can a class have both static constructor and normal constructor. & which one is called first.
- Can a static class have non-static constructor.
- Boxing and unboxing example.
- Viewstate and where it is stored.
- Encapsulation and abstraction . example and how to use in c#.
- Association , composition and aggregation
- Multiple abstract class inheritance possible?
- can we create object of abstract class.
- difference between abstract and interface.
- dataview and datatable
- truncate and delete
- remove duplicate records.
- throw and throw ex : Answer: Throw will rethrow original exception;throw ex will create a new exception, so the stack trace changes.
- multiple ways of hosting wcf
- viewstate and where it is stored.
- Abstract class have constructor or not? If yes then why we cant instantiate it.
- DDL and DML commands
- Satellite assembly.
- Hashtable Vs Dictionary : * a Dictionary is a hash table* Dictionary is a generic type, Hashtable is not. That means you get type safety with Dictionary, because you can’t insert any random object into it, and you don’t have to cast the values you take out. And also generic collections are a lot faster as there’s no boxing/unboxing.
- How to Set Master Page dynamically? : void Page_PreInit(Object sender, EventArgs e)
this.MasterPageFile = “~/MyMaster.master”;
Explanation: You can attach a master page dynamically to a content page. Because the master page and content page are merged during the initialization stage of page processing, a master page must be assigned before then. Typically, you assign a master page dynamically during the PreInit stage
An interface is a contract: The guy writing the interface says, “hey, I accept things looking that way”, and the guy using the interface says “OK, the class I write looks that way”.
An interface is an empty shell. There are only the signatures of the methods, which implies that the methods do not have a body. The interface can’t do anything. It’s just a pattern
Abstract classes look a lot like interfaces, but they have something more: You can define a behavior for them. It’s more about a guy saying, “these classes should look like that, and they have that in common, so fill in the blanks!”.
=>Methods and members of an abstract class can be defined with any visibility, whereas all methods of an interface must be defined as public (they are defined public by default).
=>hen inheriting an abstract class, a concrete child class must define the abstract methods, whereas an abstract class can extend another abstract class and abstract methods from the parent class don’t have to be defined.Similary interface.
=>A child class can only extend a single class (abstract or concrete), whereas an interface can extend or a class can implement multiple other interfaces
=> A child class can define abstract methods with the same or less restrictive visibility, whereas a class implementing an interface must define the methods with the exact same visibility (public)
- Design Patterns: a design pattern is a general repeatable solution to a commonly occurring problem in software design.Design patterns can speed up the development process by providing tested, proven development paradigms.
Types: creational, structural , behavior
creational: abstract factory, builder , factory method,object pool, prototype,singleton
structural: adapter, bridge,facade, flyweight,proxy.
31: State Management in asp.net: Server side: session Generally session is used to store user’s information and/or uniquely identify a user (or say browser). The server maintains the state of user information by using a session ID. and application :the date stored in application state is common for all users of that particular ASP.NET application and can be accessed anywhere in the application. It is also called application level state management. Data stored in the application should be of small size.
- Dynamic loading of Ui.
- Claims Authentication
- Model and ViewModel : how would you ignore particular property from being inserted into DB
- static class cannot be marked sealed because it is made sealed by compiler by default. Static classes are sealed and therefore cannot be inherited.
- static class cannot be marked as abstract, because it would be pointless. abstract class makes sense when you want all derived classes to implement same part of the logic. But because static class cannot be derived there is no way other class will implement these gaps. They cannot inherit from any class except Object
- Partial Classes and Parital Methods:(can only be implemented once.)
- Jb tk override use ni karenge tb tk base class function change ni ho skta and new keyword is only to tell compiler to hide the implementation of base class to derived class.
- Use AllowAnonymous if u dont want action to be Authroized.
- Difference between == and equals? Ans: Equals compares values(i.e, contents are same or not) , while == compares object references . My rule of thumb is that for almost all reference types, use Equals when you want to test equality rather than reference identity. But with string dataType both will do content comparison.
- what problem does delegate solves :
Ans. By defining a delegate, you are saying to the user of your class, “Please feel free to assign, any method that matches this signature, to the delegate and it will be called each time my delegate is called“. Laymen language: delegate is a representative to communicate between 2 parties. The real use of delegates in C# is callbacks.
- Difference between var and dynamic: var is compile time and dynamic is runtime.
- Difference between dispose and finalize.
- Difference between model and view model?
Ans: A Model is an object that we use to send information to the database, to perform business calculations and to render a view .ViewModel in the MVC design pattern is very similar to a “model”. The major difference between “Model” and “ViewModel” is that we use a ViewModel only in rendering views. We put all our ViewModel classes in a “ViewModels” named folder, we create this folder.
- Difference between 3-tier and 3-layer architecture.
- Difference between promise and observable.
- MVC request lifecycle and pagelifecycle.
- What is web api content negotiation? the process of selecting the best representation for a given response when there are multiple representations available. “Content Negotiation” means the client and server can negotiate. It’s not always possible for the server to return data in the requested format. That’s why it’s called negotiation, not demand. Ha.Ha.. And in this case the service will return data in the default format.
The question is, how does the Web API know what the clinet expects? By checking below the header of the request object.
Content-type:, Accept: , Accept-Charset: , Accept-Encoding: ,Accept-Language:
- Global.asax? And different methods inside it?
- What happen between OnResultExecuting and OnResultExecuted?
- Different types of ActionResult?
- Use of Partial Class
- What is managed code and How can we identify which code is managed code
- Example of encapsulation and abstractions
- Architecture of application
- Design Principle
- Runtime vs compile time polymorphism
What are the differences between events and delegates in C#?
- Exception Handling in MVC
- Return different view if we have exception filter based on role.
System.Object vs dynamic
Why base class instance can not be stored in derived class reference?
Threads vs process
large/small object heap in c#?
modelbinders asp.net mvc
New html5 features in JS
https options used for ?
Angular existing services example other than http
Can we have multiple ng-app in SPA?
Challenging thing you have ever done , like extending some support in library?
Can we have child class having default constructor and parent class have only parameterized constructor only?