Escolar Documentos
Profissional Documentos
Cultura Documentos
TCSTechnicalInterviewQuestionsandAnswers
TCSPossibleTechnicalInterviewQuestions|fornewCampusRecruitment
InterviewWithTCS
TheCampus Interview
Thisinterviewusuallytakes45minutestoanhourandmayhaveoneortwointerviewers.Oneinterviewermayfocusonyourcommu
skillsandbackgroundbyaskingbehavioralquestions.Theotherwillfocusonyourtechnicalcapabilities.
IfTCSnotcomingtoyourschoolthisfall,andyouhaveprobablysubmittedyourresumeonline.Youlookgreatonpaperandtheywo
discussionwithcandidate.Theywillsetupamutuallyconvenientdateandtimeforyourphoneinterview.Yourinterviewerwillassess
managementskillsandbackgroundbyaskingbehavioralquestions.He/shemayalsoassessyourtechnicalability.Ifthephoneinte
tojoinusforaninpersoninterview.
1.JAVAisObjectOrientedwhileCisprocedural.
2.JavaisanInterpretedlanguagewhileCisacompiledlanguage.
3.CisalowlevellanguagewhileJAVAisahighlevellanguage.
4.CusesthetopdownapproachwhileJAVAusesthebottomupapproach.
5.PointergobackstageinJAVAwhileCrequiresexplicithandlingofpointers.
6.TheBehindthescenesMemoryManagementwithJAVA&TheUserBasedMemoryManagementinC.
7.JAVAsupportsMethodOverloadingwhileCdoesnotsupportoverloadingatall.
8.UnlikeC,JAVAdoesnotsupportPreprocessors,&doesnotreallythem.
9.ThestandardInput&OutputFunctionsCusestheprintf&scanffunctionsasitsstandardinput&outputwhileJAVAusestheSyst
functions.
10.ExceptionHandlinginJAVAAndtheerrors&crashesinC.
Functionsaredeclaredwithinheaderfile.Thatisfunctionprototypesexistinaheaderfile,notfunctionbodies.Theyaredefinedinlibr
9.What is an object?
Objectisasoftwarebundleofvariablesandrelatedmethods.Objectshavestateandbehavior
10.What is a class?
ClassisauserdefineddatatypeinC++.Itcanbecreatedtosolveaparticularkindofproblem.Aftercreationtheuserneednotknow
class.
http://placement.freshersworld.com/tcstechnicalinterviewquestionsandanswers/33122057 2/10
7/21/2016 TCSTechnicalInterviewQuestionsandAnswers
Pointer isavariableinaprogramissomethingwithaname,thevalueofwhichcanvary.Thewaythecompilerandlinkerhandlesth
aspecificblockofmemorywithinthecomputertoholdthevalueofthatvariable.
Functionoverloading:C++enablesseveralfunctionsofthesamenametobedefined,aslongasthesefunctionshavedifferentsetso
theirtypesareconcerned).Thiscapabilityiscalledfunctionoverloading.Whenanoverloadedfunctioniscalled,theC++compilersel
examiningthenumber,typesandorderoftheargumentsinthecall.Functionoverloadingiscommonlyusedtocreateseveralfunctio
similartasksbutondifferentdatatypes.
OperatoroverloadingallowsexistingC++operatorstoberedefinedsothattheyworkonobjectsofuserdefinedclasses.Overloaded
equivalentfunctioncalls.Theyformapleasantfacadethatdoesn'taddanythingfundamentaltothelanguage(buttheycanimproveu
maintenancecosts).
Anabstractclassisaclasswhichdoesnotfullyrepresentanobject.Instead,itrepresentsabroadrangeofdifferentclassesofobjec
extendsonlytothefeaturesthatthoseclassesofobjectshaveincommon.Thus,anabstractclassprovidesonlyapartialdescription
http://placement.freshersworld.com/tcstechnicalinterviewquestionsandanswers/33122057 3/10
7/21/2016 TCSTechnicalInterviewQuestionsandAnswers
Thefreesubroutinefreesablockofmemorypreviouslyallocatedbythemallocsubroutine.UndefinedresultsoccurifthePointerpara
Pointerparameterisanullvalue,noactionwilloccur.Thereallocsubroutinechangesthesizeoftheblockofmemorypointedtobyth
numberofbytesspecifiedbytheSizeparameterandreturnsanewpointertotheblock.ThepointerspecifiedbythePointerparamet
themalloc,calloc,orreallocsubroutinesandnotbeendeallocatedwiththefreeorreallocsubroutines.Undefinedresultsoccurifthe
pointer.
Arrayiscollectionofhomogeneouselements.Listiscollectionofheterogeneouselements.
ForArraymemoryallocatedisstaticandcontinuous.ForListmemoryallocatedisdynamicandRandom.
Array:Userneednothavetokeepintrackofnextmemoryallocation.
List:UserhastokeepinTrackofnextlocationwherememoryisallocated.
Arrayusesdirectaccessofstoredmembers,listusessequentialaccessformembers.
OperatingSystem,
DatabaseManagementSystem,
Statisticalanalysispackage,
NumericalAnalysis,
Graphics,
ArtificialIntelligence,
Simulation
Itpermitscodereusability.Reusabilitysavestimeinprogramdevelopment.Itencouragesthereuseofprovenanddebuggedhighqu
problemafterasystembecomesfunctional.
http://placement.freshersworld.com/tcstechnicalinterviewquestionsandanswers/33122057 4/10
7/21/2016 TCSTechnicalInterviewQuestionsandAnswers
Thetwotypesofintegrityrulesarereferentialintegrityrulesandentityintegrityrules.Referentialintegrityrulesdictatethatadatabas
keyvalues.Thismeansthat
Aprimarykeyvaluecannotbemodifiedifthevalueisusedasaforeignkeyinachildtable.Entityintegritydictatesthattheprimaryk
26. Tell something about deadlock and how can we prevent dead lock?
Inanoperatingsystem,adeadlockisasituationwhichoccurswhenaprocessentersawaitingstatebecausearesourcerequestedb
waitingprocess,whichinturniswaitingforanotherresource.Ifaprocessisunabletochangeitsstateindefinitelybecausetheresou
usedbyotherwaitingprocess,thenthesystemissaidtobeinadeadlock.
MutualExclusion:Atleastoneresourcemustbenonshareable.[1]Onlyoneprocesscanusetheresourceatanygiveninstantoftim
HoldandWaitorResourceHolding:Aprocessiscurrentlyholdingatleastoneresourceandrequestingadditionalresourceswhicha
NoPreemption:Theoperatingsystemmustnotdeallocateresourcesoncetheyhavebeenallocatedtheymustbereleasedbytheh
CircularWait:Aprocessmustbewaitingforaresourcewhichisbeingheldbyanotherprocess,whichinturniswaitingforthefirstpr
general,thereisasetofwaitingprocesses,P={P1,P2,...,PN},suchthatP1iswaitingforaresourceheldbyP2,P2iswaitingfora
PNiswaitingforaresourceheldbyP1.[1][7]
Thuspreventionofdeadlockispossiblebyensuringthatatleastoneofthefourconditionscannothold.
27. What is Insertion sort, selection sort, bubble sort( basic differences among the functionality of the three sorts and not th
Adoublylinkedlistisalinkeddatastructurethatconsistsofasetofsequentiallylinkedrecordscallednodes.Eachnodecontainstw
referencestothepreviousandtothenextnodeinthesequenceofnodes.Thebeginningandendingnodes'previousandnextlinks,
terminator,typicallyasentinelnodeornull,tofacilitatetraversalofthelist.Ifthereisonlyonesentinelnode,thenthelistiscircularlyl
beconceptualizedastwosinglylinkedlistsformedfromthesamedataitems,butinoppositesequentialorders.
29.What is data abstraction? what are the three levels of data abstraction with Example?
Abstractionistheprocessofrecognizingandfocusingonimportantcharacteristicsofasituationorobjectandleaving/filteringoutthe
situationorobject.
Letstakeapersonasexampleandseehowthatpersonisabstractedinvarioussituations
Adoctorsees(abstracts)thepersonaspatient.Thedoctorisinterestedinname,height,weight,age,bloodgroup,previousorexistin
Anemployersees(abstracts)apersonasEmployee.Theemployerisinterestedinname,age,health,degreeofstudy,workexperien
Abstractionisthebasisforsoftwaredevelopment.Itsthroughabstractionwedefinetheessentialaspectsofasystem.Theprocesso
givensystemiscalledasModeling(orobjectmodeling).
Threelevelsofdataabstractionare:
1.Physicallevel:howthedataisstoredphysicallyandwhereitisstoredindatabase.
2.Logicallevel:whatinformationordataisstoredinthedatabase.eg:Databaseadministrator
3.Viewlevel:endusersworkonviewlevel.ifanyamendmentismadeitcanbesavedbyothername.
Gettingtheargumentsfromcommandpromptincisknownascommandlinearguments.Incmainfunctionhasthreearguments.The
http://placement.freshersworld.com/tcstechnicalinterviewquestionsandanswers/33122057 5/10
7/21/2016 TCSTechnicalInterviewQuestionsandAnswers
Argumentcounter
Argumentvector
Environmentvector
33.Which header file should you include if you are to develop a function which can accept variable number of arguments?
stdarg.h
CacheMemoryisusedbythecentralprocessingunitofacomputertoreducetheaveragetimetoaccessmemory.Thecacheisasm
whichstorescopiesofthedatafromthemostfrequentlyusedmainmemorylocations.Aslongasmostmemoryaccessesarecached
latencyofmemoryaccesseswillbeclosertothecachelatencythantothelatencyofmainmemory.
35.What is debugger?
Adebuggerordebuggingtoolisacomputerprogramthatisusedtotestanddebugotherprograms
36. Const char *p , char const *p What is the difference between the above two?
1)constchar*pPointertoaConstantchar('p'isn'tmodifiablebutthepointeris)
2)charconst*pAlsopointertoaconstantChar
Howeverifyouhadsomethinglike:
char*constpThisdeclares'p'tobeaconstantpointertoanchar.(Charpismodifiablebutthepointerisn't)
Datastructurealignmentisthewaydataisarrangedandaccessedincomputermemory.Itconsistsoftwoseparatebutrelatedissue
structurepadding.
38.Explain the difference between 'operator new' and the 'new' operator?
Thedifferencebetweenthetwoisthatoperatornewjustallocatesrawmemory,nothingelse.Thenewoperatorstartsbyusingopera
thenitinvokestheconstructorfortherighttypeofobject,sotheresultisarealliveobjectcreatedinthatmemory.Ifthatobjectcontai
embeddedorasbaseclasses)thoseconstructorsasinvokedaswell.
Thekeyworddeleteisusedtodestroythesinglevariablememorycreateddynamicallywhichispointedbysinglepointervariable.
http://placement.freshersworld.com/tcstechnicalinterviewquestionsandanswers/33122057 6/10
7/21/2016 TCSTechnicalInterviewQuestionsandAnswers
Eg:int*r=new(int)
thememorypointedbyrcanbedeletedbydeleter.
delete[]isusedtodestroyarrayofmemorypointedbysinglepointervariable.
Eg:int*r=new(inta[10])
Thememorypointedbyrcanbedeletedbydelete[]r.
Aconversionconstructorisasingleparameterconstructorthatisdeclaredwithoutthefunctionspecifier'explicit'.Thecompilerusesc
objectsfromthetypeofthefirstparametertothetypeoftheconversionconstructor'sclass.Todefineimplicitconversions,C++usesc
constructorsthatacceptasingleparameterandinitializeanobjecttobeacopyofthatparameter.
42. Why should we use data ware housing and how can you extract data for analysis with example?
Ifyouwanttogetinformationonallthetechniquesofdesigning,maintaining,buildingandretrievingdata,Datawarehousingistheide
premeditatedandgeneratedforsupportingthedecisionmakingprocesswithinanorganization.
Herearesomeofthebenefitsofadatawarehouse:
oWithdatawarehousing,youcanprovideacommondatamodelfordifferentinterestareasregardlessofdata'ssource.Inthisway,i
analyzeinformation.
oManyinconsistenciesareidentifiedandresolvedbeforeloadingofinformationindatawarehousing.Thismakesthereportinganda
oThebestpartofdatawarehousingisthattheinformationisunderthecontrolofusers,sothatincasethesystemgetspurgedover
andsafelystoredforlongertimeperiod.
oBecauseofbeingdifferentfromoperationalsystems,adatawarehousehelpsinretrievingdatawithoutslowingdowntheoperationa
oDatawarehousingenhancesthevalueofoperationalbusinessapplicationsandcustomerrelationshipmanagementsystems.
feedback
oDatawarehousingalsoleadstoproperfunctioningofsupportsystemapplicationsliketrendreports,exceptionreportsandtheactua
Data mining is a powerful new technology to extract data for analysis.
43.Explain recursive function & what is the data structures used to perform recursion?
a)Arecursivefunctionisafunctionwhichcallsitself.
b)Thespeedofarecursiveprogramisslowerbecauseofstackoverheads.(ThisattributeisevidentifyourunaboveCprogram.)
c)Arecursivefunctionmusthaverecursiveconditions,terminatingconditions,andrecursiveexpressions.
Stackdatastructure.BecauseofitsLIFO(LastInFirstOut)propertyitremembersitscallersoknowswhomtoreturnwhenthefunct
makesuseofsystemstackforstoringthereturnaddressesofthefunctioncalls.Everyrecursivefunctionhasitsequivalentiterative(
http://placement.freshersworld.com/tcstechnicalinterviewquestionsandanswers/33122057 7/10
7/21/2016 TCSTechnicalInterviewQuestionsandAnswers
whensuchequivalentiterativeproceduresarewritten,explicitstackistobeused.
46.What is an interrupt?
Interruptisanasynchronoussignalinformingaprogramthataneventhasoccurred.Whenaprogramreceivesaninterruptsignal,i
Garbagecollectionisthesystematicrecoveryofpooledcomputerstoragethatisbeingusedbyaprogramwhenthatprogramnolong
thestorageforusebyotherprograms
(orprocesseswithinaprogram).Italsoensuresthataprogramusingincreasingamountsofpooledstoragedoesnotreachitsquota
abletofunction).
Garbagecollectionisanautomaticmemorymanagementfeatureinmanymodernprogramminglanguages,suchasJavaandlangua
LanguagesthatusegarbagecollectionareofteninterpretedorrunwithinavirtualmachineliketheJVM.Ineachcase,theenvironme
feedback
responsibleforgarbagecollection.
while(left<=right)
{
http://placement.freshersworld.com/tcstechnicalinterviewquestionsandanswers/33122057 8/10
7/21/2016 TCSTechnicalInterviewQuestionsandAnswers
middle=((left+right)/2)
if(item==arr[middle])
{
return(middle)
}
if(item>arr[middle])
{
left=middle+1
}
else
{
right=middle1
}
}
return(1)
}
Thestaticidentifierisusedforinitializingonlyonce,andthevalueretainsduringthelifetimeoftheprogram/application.Aseparate
variables.Thisvaluecanbeusedbetweenfunctioncalls.Thedefaultvalueofanuninitializedstaticvariableiszero.Afunctioncanal
whichhasthesamescopeofthestaticvariable.
53.What is Cryptography?
Cryptographyisthescienceofenablingsecurecommunicationsbetweenasenderandoneormorerecipients.Thisisachievedbyth
feedback
(withacomputerprogramandasecretkey)andleavingtherecipienttounscramblethemessage(withthesamecomputerprograma
bethesameasthesender'skey).
Therearetwotypesofcryptography:Secret/SymmetricKeyCryptographyandPublicKeyCryptography
54.What is encryption?
Encryptionisthetransformationofinformationfromreadableformintosomeunreadableform.
55.What is decryption?
Decryptionisthereverseofencryptionit'sthetransformationofencrypteddatabackintosomeintelligibleform.
http://placement.freshersworld.com/tcstechnicalinterviewquestionsandanswers/33122057 9/10
7/21/2016 TCSTechnicalInterviewQuestionsandAnswers
GetinTouchwithus
(https://www.facebook.com/freshersworld)
(http://twitter.com/freshersworld)
(http://www.linkedin.com/company/freshersw
(https://plus.google.com/+freshersworld)
(https://www.youtube.com/user/fre
com)
AdvertiseWithUs(http://www.freshersworld.com/advertise) RecruitmentSolutions(http://corp.freshersworld
ContactUs(http://www.freshersworld.com/contactus)
20062016Freshersworld.com
feedback
http://placement.freshersworld.com/tcstechnicalinterviewquestionsandanswers/33122057 10/10