Vous êtes sur la page 1sur 6

1.Whatisdatastructure?

Ans:Thelogicalandmathematicalmodelofaparticularorganizationofdataiscalleddata
structure.Therearetwotypesofdatastructure
i)Linear
ii)Nonlinear
2.WhatarethegoalsofDataStructure?
Ans:Itmustrichenoughinstructuretoreflecttheactualrelationshipofdatainrealworld.
Thestructureshouldbesimpleenoughforefficientprocessingofdata.
3.WhatdoesabstractDataTypeMean?
Ans:Datatypeisacollectionofvaluesandasetofoperationsonthesevalues.Abstractdata
typerefertothemathematicalconceptthatdefinethedatatype.
Itisausefultoolforspecifyingthelogicalpropertiesofadatatype.
ADTconsistsoftwoparts
1)Valuesdefinition
2)Operationdefinition
Example:ThevaluedefinitionfortheADTRATIONALstatesthatRATIONALvalueconsists
oftwointegers,seconddoesntequaltozero.
TheoperatordefinitionforADTRATIONALincludestheoperationofcreation(makerational)
addition,multiplicationandtestforequality.
4.WhatisthedifferencebetweenaStackandanArray?
Ans:
i)Stackisaorderedcollectionofitems
ii)Stackisadynamicobjectwhosesizeisconstantlychangingasitemsarepushedandpopped.
iii)Stackmaycontaindifferentdatatypes
iv)Stackisdeclaredasastructurecontaininganarraytoholdtheelementofthestack,andan
integertoindicatethecurrentstacktopwithinthearray.
ARRAY
i)Arrayisanorderedcollectionofitems
ii)Arrayisastaticobjecti.e.noofitemisfixedandisassignedbythedeclarationofthearray
iii)Itcontainssamedatatypes.
iv)Arraycanbehomeofastacki.e.arraycanbedeclaredlargeenoughformaximumsizeofthe
stack.
5.Whatdoyoumeanbyrecursivedefinition?
Ans:T
hedefinitionwhichdefinesanobjectintermsofsimplercasesofitselfiscalledrecursive
definition.
6.Whatissequentialsearch?
Ans:Insequentialsearcheachiteminthearrayiscomparedwiththeitembeingsearcheduntila
matchoccurs.Itisapplicabletoatableorganizedeitherasanarrayorasalinkedlist.
7.Whatactionsareperformedwhenafunctioniscalled?
Ans:Whenafunctioniscalled
i)argumentsarepassed
ii)localvariablesareallocatedandinitialized

ii)transferringcontroltothefunction
8.Whatactionsareperformedwhenafunctionreturns?
Ans:
i)Returnaddressisretrieved
ii)Functionsdataareaisfreed
iii)Branchistakentothereturnaddress
9.Whatisalinkedlist?
Ans:Alinkedlistisalinearcollectionofdataelements,callednodes,wherethelinearorderis
givenbypointers.Eachnodehastwopartsfirstpartcontaintheinformationoftheelement
secondpartcontainstheaddressofthenextnodeinthelist.
10.Whataretheadvantagesoflinkedlistoverarray(staticdatastructure)?
Ans:
Thedisadvantagesofarrayare
i)unlikelinkedlistitisexpensivetoinsertanddeleteelementsinthearray
ii)Onecantdoubleortriplethesizeofarrayasitoccupiesblockofmemoryspace.
Inlinkedlist
i)eachelementinlistcontainsafield,calledalinkorpointerwhichcontainstheaddressofthe
nextelement
ii)Successiveelementsneednotoccupyadjacentspaceinmemory.
11.Canweapplybinarysearchalgorithmtoasortedlinkedlist,why?
12.Whatdoyoumeanbyfreepool?
13.Whatdoyoumeanbygarbagecollection?
14.Whatdoyoumeanbyoverflowandunderflow?
15.Whatarethedisadvantagesarrayimplementationoflinkedlist?
16.Whatisaqueue?
17.Whatisapriorityqueue?
18.Whatarethedisadvantagesofsequentialstorage?
19.Whatarethedisadvantagesofrepresentingastackorqueuebyalinkedlist?
20.Whatisdanglingpointerandhowtoavoidit?
21.Whatarethedisadvantagesoflinearlist?
Ans:
i)Wecannotreachanyofthenodesthatprecedenode(p)
ii)Ifalististraversed,theexternalpointertothelistmustbeperseveredinordertoreferencethelist
again

22.Definecircularlist?
Ans:Inlinearlistthenextfieldofthelastnodecontainanullpointer,whenanextfieldinthe
lastnodecontainapointerbacktothefirstnodeitiscalledcircularlist.
AdvantagesFromanypointinthelistitispossibletoreachatanyotherpoint
23.Whatarethedisadvantagesofcircularlist?
Ans:
i)Wecanttraversethelistbackward

ii)Ifapointertoanodeisgivenwecannotdeletethenode
24.Definedoublelinkedlist?
Ans:Itisacollectionofdataelementscallednodes,whereeachnodeisdividedintothreeparts
i)Aninfofieldthatcontainstheinformationstoredinthenode
ii)Leftfieldthatcontainpointertonodeonleftside
iii)Rightfieldthatcontainpointertonodeonrightside
25.Isitnecessarytosortafilebeforesearchingaparticularitem?
Ans:
Iflessworkisinvolvedinsearchingaelementthantosortandthenextract,thenwedontgofor
sort
Iffrequentuseofthefileisrequiredforthepurposeofretrievingspecificelement,itismore
efficienttosortthefile.
Thusitdependsonsituation.
26.Whataretheissuesthathampertheefficiencyinsortingafile?
Ans:Theissuesare
i)Lengthoftimerequiredbytheprogrammerincodingaparticularsortingprogram
ii)Amountofmachinetimenecessaryforrunningtheparticularprogram
iii)Theamountofspacenecessaryfortheparticularprogram.
27.Calculatetheefficiencyofsequentialsearch?
Ans:Thenumberofcomparisonsdependsonwheretherecordwiththeargumentkeyappearsin
thetable
Ifitappearsatfirstpositionthenonecomparison
Ifitappearsatlastpositionthenncomparisons
Average=(n+1)/2comparisons
Unsuccessfulsearchncomparisons
NumberofcomparisonsinanycaseisO(n).
28.Isanyimplicitargumentsarepassedtoafunctionwhenitiscalled?
Ans:Yesthereisasetofimplicitargumentsthatcontaininformationnecessaryforthefunction
toexecuteandreturncorrectly.Oneofthemisreturnaddresswhichisstoredwithinthe
functionsdataarea,atthetimeofreturningtocallingprogramtheaddressisretrievedandthe
functionbranchestothatlocation.
29.ParenthesisisneverrequiredinPostfixorPrefixexpressions,why?
Ans:Parenthesisisnotrequiredbecausetheorderoftheoperatorsinthepostfix/prefix
expressionsdeterminestheactualorderofoperationsinevaluatingtheexpression
30.Listouttheareasinwhichdatastructuresareappliedextensively?
Ans:
CompilerDesign,
OperatingSystem,
DatabaseManagementSystem,
Statisticalanalysispackage,
NumericalAnalysis,
Graphics,

ArtificialIntelligence,
Simulation

31.Whatarethemajordatastructuresusedinthefollowingareas:networkdatamodel&
Hierarchicaldatamodel.
Ans:
RDBMSArray(i.e.Arrayofstructures)
NetworkdatamodelGraph
HierarchicaldatamodelTrees
32.IfyouareusingClanguagetoimplementtheheterogeneouslinkedlist,whatpointer
typewillyouuse?
Ans:Theheterogeneouslinkedlistcontainsdifferentdatatypesinitsnodesandweneedalink,
pointertoconnectthem.Itisnotpossibletouseordinarypointersforthis.Sowegoforvoid
pointer.Voidpointeriscapableofstoringpointertoanytypeasitisagenericpointertype.
33.Minimumnumberofqueuesneededtoimplementthepriorityqueue?
Ans:Two.Onequeueisusedforactualstoringofdataandanotherforstoringpriorities.
34.Whatisthedatastructuresusedtoperformrecursion?
Ans:Stack.BecauseofitsLIFO(LastInFirstOut)propertyitremembersitscallersoknows
whomtoreturnwhenthefunctionhastoreturn.Recursionmakesuseofsystemstackforstoring
thereturnaddressesofthefunctioncalls.
Everyrecursivefunctionhasitsequivalentiterative(nonrecursive)function.Evenwhensuch
equivalentiterativeproceduresarewritten,explicitstackistobeused.
35.WhatarethenotationsusedinEvaluationofArithmeticExpressionsusingprefixand
postfixforms?
Ans:PolishandReversePolishnotations.
36.Converttheexpression((A+B)*C(DE)^(F+G))toequivalentPrefixand
Postfixnotations.
Ans:PrefixNotation:
^*+ABCDE+FG
PostfixNotation:
AB+C*DEFG+^

37.Sortingisnotpossiblebyusingwhichofthefollowingmethods?
(a)Insertion
(b)Selection
(c)Exchange
(d)Deletion
Ans:(d)Deletion.
Usinginsertionwecanperforminsertionsort,usingselectionwecanperformselectionsort,
usingexchangewecanperformthebubblesort(andothersimilarsortingmethods).Butno
sortingmethodcanbedonejustusingdeletion.
38.ListoutfewoftheApplicationoftreedatastructure?

Ans:
ThemanipulationofArithmeticexpression,
SymbolTableconstruction,
Syntaxanalysis.
39.ListoutfewoftheapplicationsthatmakeuseofMultilinkedStructures?
Ans:Sparsematrix,Indexgeneration.
40.intreeconstructionwhichisthesuitableefficientdatastructure?
(A)Array(b)Linkedlist(c)Stack(d)Queue(e)none
Ans:(b)Linkedlist

41.Whatisthetypeofthealgorithmusedinsolvingthe8Queensproblem?
Ans:Backtracking
42.InanAVLtree,atwhatconditionthebalancingistobedone?
Ans:Ifthepivotalvalue(ortheHeightfactor)isgreaterthan1orlessthan1.
43.Thereare8,15,13,14nodesweretherein4differenttrees.Whichofthemcouldhave
formedafullbinarytree?
Ans:15
Ingeneral:
Thereare2n1nodesinafullbinarytree.
Bythemethodofelimination:
Fullbinarytreescontainoddnumberofnodes.Sotherecannotbefullbinarytreeswith8or14
nodes,sorejected.With13nodesyoucanformacompletebinarytreebutnotafullbinarytree.
Sothecorrectansweris15.
Note:FullandCompletebinarytreesaredifferent.Allfullbinarytreesarecompletebinarytrees
butnotviceversa.
44.InRDBMS,whatistheefficientdatastructureusedintheinternalstorage
representation?
Ans:B+tree.BecauseinB+tree,allthedataisstoredonlyinleafnodes,thatmakessearching
easier.Thiscorrespondstotherecordsthatshall
bestoredinleafnodes.
45.Oneofthefollowingtreestructures,whichis,efficientconsideringspaceandtime
complexities?
a)IncompleteBinaryTree.
b)CompleteBinaryTree.
c)FullBinaryTree.
Ans:
b)CompleteBinaryTree.
Bythemethodofelimination:
Fullbinarytreelosesitsnaturewhenoperationsofinsertionsanddeletionsaredone.For
incompletebinarytrees,
extrapropertyofcompletebinarytreeismaintainedevenafteroperationslikeadditionsand
deletionsaredoneonit.

46.WhatisaspanningTree?
Ans:Aspanningtreeisatreeassociatedwithanetwork.Allthenodesofthegraphappearon
thetreeonce.Aminimumspanningtreeisaspanningtreeorganizedsothatthetotaledgeweight
betweennodesisminimized.
47.Doestheminimumspanningtreeofagraphgivetheshortestdistancebetweenany2
specifiednodes?
Ans:No.
Minimalspanningtreeassuresthatthetotalweightofthetreeiskeptatitsminimum.Butit
doesntmeanthatthedistancebetweenanytwonodesinvolvedintheminimumspanningtreeis
minimum.
48.WhetherLinkedListislinearorNonlineardatastructure?
Ans:AccordingtoStorageLinkedListisaNonlinearone.