Vous êtes sur la page 1sur 7

MorePattern&PracticesInterviewQuestionsPart1(/articles/show/130/designpatterninterviewquestionspart1)|Part2(/articles/show/135/design

patterninterviewquestionspart2)|Part3(/articles/show/137/designpatterninterviewquestionspart3)|Part4(/articles/show/139/designpattern
interviewquestionspart4)

DesignPattern&PracticesInterviewQuestionsandAnswers(103)Page1
LatestandauthenticInterviewquestions.Youcanalsopostaninterviewquestion(/interviews/postexamquestion.aspx)andwinmonthlyprizes
(/misc/page3.aspx)aswellasgaincommunitycreditpoints(/misc/page14.aspx#points).
103recordsfound.

Search

SearchInterviews

(http://feeds2.feedburner.com/DotnetfundaInterviewQuestions)
Post(/interviews/postexamquestion.aspx)|

InterviewExperiences(/interviews/experiences.aspx)|
OnlineInterviews(/interviews/interviewtest.aspx)|

InterviewFAQs(/interviews/faq/)|

ExclusiveQuestions(/interviews/exclusive/)

Get650+Questpond'sInterviewvideosondiscount(http://www.itfunda.com/Interview)

WhatisPrototyping?
(/interviews/show/78/whatisprototyping)
Prototypingistheprocessofquicklyputtingtogetheraworkingmodelinordertotestvariousaspectsofadesign,illustrateideasorfeatures&gatherearly
userfeedback.Itisbelievedtoreduceprojectrisksandcost.

WhatisTestDrivenDevelopment(TDD)?
(/interviews/show/270/whatistestdrivendevelopmenttdd)
TDDisasoftwaredevelopmentmethodologyinvolvingrepeatedlywritingtestcasesforclassesandthenbuildingthecorrespondingclassestoimplementonly
thecodenecessarytosuccessfulpassthetests.
Formoreterminologyvisit:http://www.headspringsystems.com/terminology.jsp

WhatisDomaindrivendesign(DDD)?
(/interviews/show/271/whatisdomaindrivendesignddd)
Domaindrivendesign(DDD)isanapproachtothedesignofsoftware,basedonthetwopremisesthatcomplexdomaindesignsshouldbebasedonamodel,
andthat,formostsoftwareprojects,theprimaryfocusshouldbeonthedomainanddomainlogic(asopposedtobeingtheparticulartechnologyusedto
implementthesystem).
Fordetailvisit:http://en.wikipedia.org/wiki/Domaindriven_design

WhatisSRP?
(/interviews/show/278/whatissrp)
SRPstandsforSingleResponsibilityPrinciple.Thisstatesthataclassshouldhaveonlyonereasontochange.Ifaclassisdoingtoomuch(i.e.hittingtheDB,
writingfiles,doingbusinesslogic,callingawebservice,etc,itsviolatingSRP.Itwillbeverydifficulttochangelatershouldweneedtochangeit,anditwill
likelybepronetohavemoredefects.
SRPappliestothemethodsorinaclassalso.Thetwoareinseparable.Aclass,orobject,isthecombinationofitsdataanditsbehavior.
Formoredetailsreadthisdocument:SingleResponsibilityPrinciple
http://www.objectmentor.com/resources/articles/srp.pdf
Source:WithinputfromChadMyers

TheIHttpHandlerandIHttpHandlerFactoryinterfaces?
(/interviews/show/667/theihttphandlerandihttphandlerfactoryinterfaces)
TheIHttpHandlerinterfaceisimplementedbyallthehandlers.TheinterfaceconsistsofonepropertycalledIsReusable.TheIsReusablepropertygetsavalue
indicatingwhetheranotherrequestcanusetheIHttpHandlerinstance.ThemethodProcessRequest()allowsyoutoprocessthecurrentrequest.Thisisthe
coreplacewhereallyourcodegoes.ThismethodreceivesaparameteroftypeHttpContextusingwhichyoucanaccesstheintrinsicobjectssuchasRequest
andResponse.TheIHttpHandlerFactoryinterfaceconsistsoftwomethodsGetHandlerandReleaseHandler.TheGetHandler()methodinstantiatesthe
requiredHTTPhandlerbasedonsomeconditionandreturnsitbacktoASP.NET.TheReleaseHandler()methodallowsthefactorytoreuseanexistinghandler.

Whataredesignpatterns
(/interviews/show/2020/whataredesignpatterns)
Designpatternsarerecurringsolutiontorecurringproblemsinsoftwarearchitecture

WhatisServiceOrientedarchitecture
(/interviews/show/2025/whatisserviceorientedarchitecture)
SOAisalogicalencapsulationofselfcontainedbusinessfunctionality.ToknowcompletelyaboutSOAvisit
http://www.dotnetfunda.com/articles/article204.aspx(http://www.dotnetfunda.com/articles/article204.aspx)onthiswebsite.

AnswerEdited:

Howtoavoidadding"SmartTags"toyourpagewhendisplayedbyXPserver?
(/interviews/show/2333/howtoavoidaddingsmarttagstoyourpagewhendisplayedbyxpserve)
Itcanbeachievedbyametatagonthepagethesyntaxis
<meta name="MSSmartTagsPreventParsing" content="TRUE">

Howmanydesignpatternsarethereandwhatarethey?
(/interviews/show/2437/howmanydesignpatternsarethereandwhatarethey)
AccordingtoGangOfFour,therearethreetypesofDesignPattern(Visithttp://dofactory.com/Patterns/Patterns.aspx
(http://dofactory.com/Patterns/Patterns.aspx)formoredetails)
1.Creational
2.Structural
3.Behavioral

CreationalDesignPattern
AbstractFactoryCreatesaninstanceofseveralfamiliesofclasses
BuilderSeparatesobjectconstructionfromitsrepresentation
FactoryMethodCreatesaninstanceofseveralderivedclasses
PrototypeAfullyinitializedinstancetobecopiedorcloned
SingletonAclassofwhichonlyasingleinstancecanexist

StructuralDesignPattern
AdapterMatchinterfacesofdifferentclasses
BridgeSeparatesanobjectsinterfacefromitsimplementation
CompositeAtreestructureofsimpleandcompositeobjects
DecoratorAddresponsibilitiestoobjectsdynamically
FacadeAsingleclassthatrepresentsanentiresubsystem
FlyweightAfinegrainedinstanceusedforefficientsharing
ProxyAnobjectrepresentinganotherobject

BehavioralDesignPattern
ChainofResp.Awayofpassingarequestbetweenachainofobjects
CommandEncapsulateacommandrequestasanobject
InterpreterAwaytoincludelanguageelementsinaprogram
IteratorSequentiallyaccesstheelementsofacollection
MediatorDefinessimplifiedcommunicationbetweenclasses
MementoCaptureandrestoreanobject'sinternalstate
ObserverAwayofnotifyingchangetoanumberofclasses
StateAlteranobject'sbehaviorwhenitsstatechanges
StrategyEncapsulatesanalgorithminsideaclass
TemplateMethodDefertheexactstepsofanalgorithmtoasubclass
VisitorDefinesanewoperationtoaclasswithoutchange
Abovepatternanddescriptionhasbeencopiedfromhttp://dofactory.com/Patterns/Patterns.aspx(http://dofactory.com/Patterns/Patterns.aspx)for
informationandknowledgepurpose.

WhatisMVCPattern?
(/interviews/show/3956/whatismvcpattern)
MVC:
ModelViewController.MVCpatternseperatestheGUIfromtheData.
ItiscommonlyusedinADO.NETprogramminginASP.NET(example)
MVCincontextwithADO.NET/ASP.NET
MVCpatternseparatesobjectsintothreeimportantsections:
Model:Thissectionisspeciallyformaintainingdata.Itisactuallywherewewrite
codefordatabaseconnectivity,methodsofDataReader,DataAdapter,properties
forpassingdataandwritingvalidations
eg:BusinessAccessLayerclass,DataAccessLayerclass.
View:Designofthe.aspxpage(Themarkuporthepresentationlayer)
Controller:Theyareeventhandlingsectionwhichaffectseitherthemodelortheview.(eg:.aspx.cs)

DifferencebetweenaLayerandTier?
(/interviews/show/4171/differencebetweenalayerandtier)
Layer:
Itreferstotheseparationofthelogic(i.ethecodeanddesign)thatisdevelopedforanapplicationindifferentfiles.
Tier:
ItreferstothephysicallocationoftheLayerfiles.
example:
InanASP.NETwebsite,wecreateGUIwebforms,businesslogic,dataaccess
logic,databaseallinonecomputer.Inthiscase,wehave4layersand1Tier.
iftheGUIWebForms,businesslogic,dataaccesslogicanddatabaseareallin
differentcomputers,wehave4layersand4Tiers.

InwhatscenariosweshouldnotuseDesignPatterns?
(/interviews/show/4185/inwhatscenariosweshouldnotusedesignpatterns)

Weshouldnotnotusedesignpatternsinfollowingscenarios
Whenthesoftwareisbeingdesignedanditwouldnotchangewithtimeandnewrequirements.
Whentherequirementsofthesourcecodeofaparticularapplicationareuniqueandsame.

Bestnamingconventionstoinitializevariables?
(/interviews/show/4481/bestnamingconventionstoinitializevariables)
Manynewdevelopersdonotconcentrateonprefixesofthevariabledeclarations.Buttheseinitializationplaysamajorrolebecauseforlargeprojectsasingle
modulewillnotbehandledbyasingleindividualsoitmustbegenericthateveryoneintheteamshouldunderstandforwhatpurposeaparticularvariable
hasbeendeclaredbyjustreadingitsnameitself.Sothesearethegenericstepstoinitializevariables.

DataTypeExamplePrefix

BooleanblnResultbln
BytebytYesbyt
CharchrSelectchr
DatedatStartdat
DoubledblSalarydbl
DecimaldecAveragedec
IntegerintStdidint
LonglngValuelng
SinglesglStocksql
ShortshoShortsho
StringstrEmpNamestr
ObjectobjSourceobj

Whatareallthethreetestcasesthatyoushouldconsiderduringunittesting?
(/interviews/show/4527/whatareallthethreetestcasesthatyoushouldconsiderduringunit)
Thethreetestcasesare:
1.PositivetestcasesWiththisweneedtoprovidecorrectdataandtestforcorrectoutput
2.NegativetestcasesWeneedtocheckforbrokenormissingdata
3.ExceptiontestcasesWhethertheexceptionswhicharethrownarehandledproperlyornot

InSingletonDesignPattern,synchronizationisessential?
(/interviews/show/4627/insingletondesignpatternsynchronizationisessential)
InSingletonDesignPattern,synchronizationisessentialonlyforthefirsttimewhentheinstanceistobecreated.Whentheinstanceiscreatedthenit
becomesanoverheadforeachrequest.
public class Singleton
{
private static Singleton uniqueinstance;

private Singleton()
{
}

public static Singleton getinstance()


{
if(uniqueinstance == null)
{
uniqueinstance = new Singleton();
}
return uniqueinstance;
}
}

Intheabovecode,whenforthefirsttimegetinstancemethodiscalled,synchronizationisneeded.Afterthefirstinstanceiscreated,wenolongerneed
synchronization.
ThanksandRegards
Akiii

InSingletonPattern,howwillyoumakesurethatthreadingisdonewithminimaloverhead?
(/interviews/show/4628/insingletonpatternhowwillyoumakesurethatthreadingisdonewit)

public sealed class Singleton


{
private static volatile Singleton instance;
private static object syncRoot = new Object();

private Singleton() {}

public static Singleton Instance


{
get
{
if (instance == null)
{
lock (syncRoot)
{
if (instance == null)
instance = new Singleton();
}
}

return instance;
}
}
}

Intheabovecode,whentheSingletoninstanceiscreatedforthefirsttimethenitislockedandsynchronizedbutnextcallorsuccessivecallsmakesurethat
thelockisnotcheckedanymorebecauseaninstancealreadyexists.Thiswaytheoverheadofcheckingthelockminimizes.
ThedoublechecklockingapproachsolvesthethreadconcurrencyproblemswhileavoidinganexclusivelockineverycalltotheInstancepropertymethod.
ThanksandRegards
Akiii

Howmanydesignpatternscanbecreated?
(/interviews/show/4640/howmanydesignpatternscanbecreated)
Thereisnolimitincreatingadesignpattern.Designpatternsarebasedonreusability,objectcreationandcommunication.Designpatternscanbecreatedin
anylanguage.
ThanksandRegards
Akiii

WhyshouldaSingletonclassbeserializedonlyonce?
(/interviews/show/4641/whyshouldasingletonclassbeserializedonlyonce)
IfaSingletonclassisserializedandthenDeserializedmultipletimes,therewillbemultipleobjectswhichwillviolatetheprinciplesofSingletonpattern.
ThereforeitshouldbeserializedandDeserializedonlyonce!
ThanksandRegards
Akiii

SingletonisalsocalledasAntiPattern,why?
(/interviews/show/4642/singletonisalsocalledasantipatternwhy)
It'sveryhardtocreateasubclass,ortocreateamockobjectforaSingletonclass.Singletonmakestheunittestingharder.Singletonhidethedependencies
andmaketheclassestightlycoupledwitheachother.
Fortheabovereasons,SingletonsarecalledasAntiPattern.
ThanksandRegards
Akiii

WhatistheimportanceofDesignPattern?
(/interviews/show/5492/whatistheimportanceofdesignpattern)
Hereisalistofpointswhichshouldbeconsiderassomeoftheadvantagesofusingdesignpattern
Itbringsloosecoupling
Itreducesobjectdependency

Itreducesobjectdependency
Itnormalizesthecommunicationbetweentheclientandtheconcreteclasses.
Simplifiestheapplicationhandshaking
Abstractthecomplexdetailsfromtheclient.
EnhancesReusability
Bringsafruitfulframework
Independentoflanguage
Componentscanbeplugable
Platformindependent
Canbeappliedincrossplatformcommunication.

2(/interviews/cat/45/designpatternpractices/20/2)

4(/interviews/cat/45/designpatternpractices/60/4)

3(/interviews/cat/45/designpatternpractices/40/3)

5(/interviews/cat/45/designpatternpractices/80/5)

6(/interviews/cat/45/designpatternpractices/100/6)

MoreDESIGNPATTERN&PRACTICESExclusiveInterviewQuestions&Answershere(/interviews/exclusive/cat/45/designpatternpractices)
Foundthisuseful,bookmarkthispagetotheblogorsocialnetworkingwebsites.

(http://www.copyscape.com/)

(https://in.pinterest.com/pin/find/?url=http://www.dotnetfunda.com/interviews/cat/45/designpatternpractices)

(mailto:sample@sample.com?subject=http://www.dotnetfunda.com/interviews/cat/45/designpatternpractices)
BookmarkIt(/post/postga.aspx?u=http%3a%2f%2fwww.dotnetfunda.com%2finterviews%2fcat%2f45%2fdesignpatternpractices)

Rs. 1,499

Rs. 999

Rs. 699

Rs. 1,499

Rs. 1,499

Rs. 1,499

Rs. 1,499

InterviewQuestionsandAnswersCategories
.NETCertifications(/interviews/cat/29/netcertifications)

.NETFramework(/interviews/cat/52/netframework)

ADO.NET(/interviews/cat/47/adonet)

Android(/interviews/cat/221/android)

AngularJS(/interviews/cat/225/angularjs)

AptituteTest(/interviews/cat/214/aptitutetest)

ASP.NET(/interviews/cat/5/aspnet)

ASP.NETAJAX(/interviews/cat/23/aspnetajax)

ASP.NETCore(/interviews/cat/229/aspnetcore)

ASP.NETMVC(/interviews/cat/131/aspnetmvc)

ASP.NETWebAPI(/interviews/cat/222/aspnetwebapi)

Azure(/interviews/cat/111/azure)

BestPractices(/interviews/cat/114/bestpractices)

BizTalkServer(/interviews/cat/90/biztalkserver)

Bootstrap(/interviews/cat/223/bootstrap)

C#(/interviews/cat/6/csharp)

Cloud(/interviews/cat/177/cloud)

CMS(/interviews/cat/134/cms)

CSS3(/interviews/cat/18/css3)

DataStructures&Algorithms(/interviews/cat/226/datastructuresalgorithms)

DesignPattern&Practices(/interviews/cat/45/designpatternpractices)

DotNetFunda.Com(/interviews/cat/167/dotnetfundacom)

EntityFramework(/interviews/cat/227/entityframework)

ErrorandSolution(/interviews/cat/126/errorandsolution)

F#(/interviews/cat/66/f)

FunctionPoints(FPA)(/interviews/cat/112/functionpointsfpa)

HR(/interviews/cat/213/hr)

HTML5(/interviews/cat/161/html5)

IIS(/interviews/cat/122/iis)

InterviewQuestions(/interviews/cat/219/interviewquestions)

JavaScript(/interviews/cat/7/javascript)

jQuery(/interviews/cat/95/jquery)

Kinect(/interviews/cat/189/kinect)

LightSwitch(/interviews/cat/159/lightswitch)

LINQ(/interviews/cat/110/linq)

Management(/interviews/cat/70/management)

MobileDevelopment(/interviews/cat/170/mobiledevelopment)

Mule(/interviews/cat/209/mule)

Networking(/interviews/cat/215/networking)

NewsandCommunity(/interviews/cat/218/newsandcommunity)

Node.js(/interviews/cat/220/nodejs)

NoSql(/interviews/cat/194/nosql)

OOPS(/interviews/cat/53/oops)

Oracle(/interviews/cat/205/oracle)

Others(/interviews/cat/16/others)

PostgreSQL(/interviews/cat/208/postgresql)

PowerShell(/interviews/cat/135/powershell)

ProductReviews(/interviews/cat/199/productreviews)

ProjectManagement(/interviews/cat/216/projectmanagement)

Python(/interviews/cat/228/python)

QA(Testing)(/interviews/cat/217/qatesting)

RegularExpressions(/interviews/cat/30/regularexpressions)

SEO(/interviews/cat/24/seo)

SharePoint(/interviews/cat/85/sharepoint)

SignalR(/interviews/cat/230/signalr)

Silverlight(/interviews/cat/83/silverlight)

SqlServer(/interviews/cat/8/sqlserver)

TypeScript(/interviews/cat/224/typescript)

UML(/interviews/cat/113/uml)

VB.NET(/interviews/cat/117/vbnet)

VisualStudio(/interviews/cat/130/visualstudio)

WCF(/interviews/cat/73/wcf)

WebAnalytics(/interviews/cat/22/webanalytics)

WebServices,Remoting(/interviews/cat/187/webservicesremoting)

Windows8(/interviews/cat/183/windows8)

WindowsForms(/interviews/cat/92/windowsforms)

WindowsMetro(/interviews/cat/200/windowsmetro)

WindowsPhone(/interviews/cat/160/windowsphone)

WPF(/interviews/cat/72/wpf)

WWF(/interviews/cat/71/wwf)

XML(/interviews/cat/125/xml)

WINNERS

Rajnilari2015

ADS

50%
OFF

50%
OFF

Rs. 1,499
60%
OFF

Rs. 399

50%
OFF

Rs. 999
30%
OFF

Rs. 1,499
50%
OFF

Rs. 699

Rs. 1,499

50%
OFF

Rs. 1,499
50%
OFF

Rs. 1,499

SOCIAL
YouTube/DNFVideo(http://www.youtube.com/dnfvideo)
Facebook/DotNetFunda(https://www.facebook.com/pages/DotNetFunda/150208065028141)
Twitter/DotNetFunda(http://twitter.com/dotnetfunda)
LinkedIn/In/DotNetFunda(http://www.linkedin.com/in/dotnetfunda)
Plus.Google.Com(https://plus.google.com/110725672744452026072/)
+978 Recommend this

LikeusonFacebook

DotNetFunda
Like Page

16k likes

Be the rst of your friends to like this

TOPINTERVIEWSAUTHORS
Wed,31Aug2016Authors
AllTimeAuthors

56720(/profile/vishalneeraj24503.aspx)
22400(/profile/rajkatie.aspx)
18040(/profile/bharathicherukuri.aspx)
Latestmembers(/misc/latestmembers.aspx)|More...(/misc/topauthors.aspx?c=3)
(Statisticsdelayedby5minutes)

ADVERTISEMENTS

KESARFASHION

KESARFASHIONWOMEN'S
COTTONSILKSAREE
(AK_RED_RED)

LATESTDESIGNPATTERN&PRACTICESARTICLES
DependencyInjectionwithUNITYandMEFinASP.NETMVC(/articles/show/3148/dependencyinjectionwithunityandmefinaspnetmvc)
LetuslearnAutofac(/articles/show/2386/letuslearnautofac)
UsingStructureMapinFactoryMethodusingFactoryPattern(/articles/show/2385/usingstructuremapinfactorymethodusingfactorypattern)
LetuslearnProviderDesignPattern(/articles/show/2306/letuslearnproviderdesignpattern)
LetuslearnFactoryPattern(/articles/show/1929/letuslearnfactorypattern)
More...(/articles/cat/45/designpatternpractices)

LATESTDESIGNPATTERN&PRACTICESFORUMS
FactoryPatternRealProjectImplementation(/forums/show/18864/factorypatternrealprojectimplementation)
WhichDesignPatterisSuitableforThis?(/forums/show/18247/whichdesignpatterissuitableforthis)
WhichistheBestDesignPatternforBankingWebApplication(/forums/show/16244/whichisthebestdesignpatternforbankingwebapplication)
PatternforInventoryManagementSoftware(/forums/show/15302/patternforinventorymanagementsoftware)
whatisuseofmvp?(/forums/show/14401/whatisuseofmvp)
More...(/forums/cat/45/designpatternpractices)

AboutUs(/about.aspx)

Shareknowledge(/misc/page10.aspx)

HostingPartner

ContactUs(/feedback.aspx)

PrivacyPolicy(/privacypolicy.aspx)

GoTop

TheTeam(/misc/page11.aspx)

TermsofUse(/termsconditions.aspx)

Testimonials(/feedbacklist.aspx)

SearchMembers
(/search/searchmembers.aspx)

Advertise(/misc/page9.aspx)

Catalogs(/catalogs/)

GeneralNotice:Ifyoufindplagiarised(copied)contentonthispage,pleaseletusknow(/feedback.aspx?writeurl=yes)originalsourcealongwithyour
correctemailid(tocommunicate)foraction.
DotNetFunda.Com.AllRightsReserved.Logos,companynamesusedhereifanyareonlyforreferencepurposesandtheymayberespectiveowner'srightor
trademarks.|8/31/20164:26:03AM

Vous aimerez peut-être aussi