Dot Net Interview questions for 3+ years of experience - Part-2




1)In MVC Framework, who decides what to render in the VIEW ?

Ans)
Select from following answers:
Model
Controller
View

Controller decides what to render in the VIEW.

Only job of the VIEW in MVC is " how to render".
-------------------------------------------------------
2)Whats is the difference between API and WebServices?

Ans)

A)Web Services gives the output in the form of XML or JSON.Where as API return the output in the form of void,
scalar or generic type
B)We need to add web references for web-services and add references for API
----------------------------------------------------------

3) Singleton is also called as Anti-Pattern, why ?
Ans)

It's very hard to create a subclass, or to create a mock object for a Singleton class.
Singleton makes the unit testing harder. Singleton hide the dependencies and make the classes tightly coupled with
each other.

For the above reasons, Singletons are called as Anti-Pattern.
---------------------------------------------------------
4) Why should a Singleton class be serialized only once ?
Ans)
If a Singleton class is serialized and then De-serialized multiple times,
there will be multiple objects which will violate the principles of Singleton pattern.
Therefore it should be serialized and De-serialized only once !
-----------------------------------------------------------
5)How many design patterns can be created ?
Ans)
There is no limit in creating a design pattern. Design patterns are based on re-usability,
object creation and communication. Design patterns can be created in any language.
-----------------------------------------------------------
6) How can we trace our view state information?
Ans)
We can trace View State of our application by placing this tag at Page Directive.

<%@ Page Language="C#" AutoEventWireUp="true" Trace="True"
-------------------------------------------------------------
7) Which of the following tool is useful to see all the methods which are used in the class file of our application ?
Ans)
Select from following answers:
  1. Object Browser
  2. Object Explorer
  3. Class Viewer
  4. Class Explorer

The Object Browser allows us to examine and
discover objects (namespaces, classes, structures, interfaces, types, enums, and so on..) and
their members (properties, methods, events, variables, constants, enum items, and so on..)
from different components. Hence we can use Object Browser to locate our methods in a class file.