You are on page 1of 6

2/13/2017 MADEEASYONLINETESTSERIES

CBT2017 AnkitKumarYadav(EnrollUser) LogOut

HOME SCORECARD TIMEMANAGEMENT QUESTIONSREPORT SOLUTION COMPAREYOURSELF



MYTEST

MYPROFILE SolutionReportForAlgorithms
Representwholetestsolutionwithcorrectandincorrectanswers.
REPORTS
ViewYourTestAnalysis
BUYPACKAGE

NEWS
Q.No QuestionStatus
AskanExpert
Q.1 WhatistheworstcasetimecomplexitytosortonarrayA[0ton]wheretheelementsatindexA[2i](atevenarrayindex)
isinitscorrectposition?

a.(n2 )
b. (nlogn)
c.(n)
d.Noneofthese

NotAttempt CorrectAns. b VideoSolution FAQ? Haveanydoubt? Solution

Q.2 What is the worst case time complexity to sort n elements by first constructing a Binary Search Tree on those n
elementsfollowedbyaninordertraversalonthetree?

a. (n2 )
b.(nlogn)
c.(n2 logn)
d.(n)

NotAttempt CorrectAns. a VideoSolution FAQ? Haveanydoubt? Solution

Q.3 WhatistheworstcasetimecomplexitytoconstructanAVLtreefromanarraywhichsatisfiestheminheapproperty?

a. (nlogn)
b.(n2 )
c.(n2 logn)
d.(n)

NotAttempt CorrectAns. a VideoSolution FAQ? Haveanydoubt? Solution

Q.4 WhichofthefollowingprocedureresultssameoutputasDijkstrasalgorithmonunweightedgraphwithnvertices?

a. Breadthfirstsearch
b.Depthfirstsearch
c.Kruskalalgorithm
d.Primsalgorithm

NotAttempt CorrectAns. a VideoSolution FAQ? Haveanydoubt? Solution

Q.5 Considerthefollowingfunction.

Whatistheworstcaserunningtimeofthefunctionfforanypositivevalueofn?

a.(1)
b.(n)
c. (n2 )
d.(n3 )

https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName=timeManagementReport&testid=1221&t=cont1&testType=2 1/6
2/13/2017 MADEEASYONLINETESTSERIES

NotAttempt CorrectAns. c VideoSolution FAQ? Haveanydoubt? Solution

Q.6 WhatisthetimecomplexityofHuffmancodingusingheaptreedatastructure?

a.(n)
b.(logn)
c. (nlogn)
d.(n2 )

NotAttempt CorrectAns. c VideoSolution FAQ? Haveanydoubt? Solution

Q.7 ConsiderthefollowingknapsackproblemwithcapacityW=8

Whichofthefollowingitemisnotselectedintheoptimalsolutionof0/1Knapsackproblem?

a.I1 only
b. I2 only
c.I3 only
d.Noneofthese

NotAttempt CorrectAns. b FAQ? Haveanydoubt? Solution

Q.8 What is worst case time complexity to find all the nodes at height v /2 from a particular node in a graph having v
verticesandeedges?

a.(v2 )
b.(vloge)
c. (v+e)
d.(v2 loge)

NotAttempt CorrectAns. c VideoSolution FAQ? Haveanydoubt? Solution

Q.9 Whichofthefollowingistrue?

a.Ifatopologicalsortexistsfortheverticesinadirectedgraph,thenDFSonthegraphwillproducenobackedges.
b.TraversingDFSalgorithmonadirectedgraphG.IfweremovedallbackedgesfromgraphG,thenresultinggraphisacyclic
graph.
c. Both(a)and(b)
d.Noneofthese

NotAttempt CorrectAns. c VideoSolution FAQ? Haveanydoubt? Solution

Q.10 Whichofthefollowingistrue?

a.TherunningtimeofRadixSortiseffectivelyindependentofwhethertheinputisalreadysorted.
b.ChangingtheRELAXfunctiontoupdateisd[v]d[u]+w(u,v)(insteadofstrictlygreaterthan)willproduceshortestpath,but
willnoteffectthecorrectnessofBellmanFordalgorithmsoutputs.
c. Both(a)and(b)
d.Noneofthese

NotAttempt CorrectAns. c VideoSolution FAQ? Haveanydoubt? Solution

Q.11 The maximum number of nodes in Binary Search Tree of height h which have same inorder and preorder will be
__________(assumeh=10androotisatheight0)

NotAttempt CorrectAns. 11 VideoSolution FAQ? Haveanydoubt? Solution

Q.12 Considerthefollowingsortingalgorithm
Sorting(A,low,high)

https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName=timeManagementReport&testid=1221&t=cont1&testType=2 2/6
2/13/2017 MADEEASYONLINETESTSERIES

Therunningtimeofsorting(A,1,n)functionis(nx ).Thevalueofx+3is__________[Usevalueofxupto1decimal
places]

NotAttempt CorrectAns. 5.7 FAQ? Haveanydoubt? Solution

Q.13 ConsiderthefollowinggraphG.

ThetotalnumberofminimumspanningtreesfromgraphGare______.

NotAttempt CorrectAns. 3 FAQ? Haveanydoubt? Solution

Q.14 Considerthefollowingtable

Thenumberofbitsthatareneededtoencodeastringcontaining14as,3bs,6csand10dsusingthehuffmancoding
are___________.

NotAttempt CorrectAns. 61 FAQ? Haveanydoubt? Solution

Q.15 Assume there is an algorithm which take (log2 log2 n) time to sort n elements algorithm, person one will takes 22
secondstoexecuteonsomedataofsizeY. Person to will take 33 seconds for data size of 256. The data size of Y is
__________.

NotAttempt CorrectAns. 16 VideoSolution FAQ? Haveanydoubt? Solution

Q.16 Considertheweightedundirectedgraphbelow

AssumethatedgeBF is added to the minimum spanning tree. The maximum value of BF so that this new edge can
belongtotheminimumspanningtreeis_________.

NotAttempt CorrectAns. 12 VideoSolution FAQ? Haveanydoubt? Solution

Q.17
Considerwehaveanalgorithmwhichgeneratepreorderofanytreein(n2 )time,wehavetocreateaBinarySearchTree
withndistinctelement.Whichofthefollowingwillrepresentstheworstcasetimecomplexity?

a.(n)
b.(nlogn)
c. (n2 )

https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName=timeManagementReport&testid=1221&t=cont1&testType=2 3/6
2/13/2017 MADEEASYONLINETESTSERIES
d.(1)

NotAttempt CorrectAns. c VideoSolution FAQ? Haveanydoubt? Solution

Q.18 Letf(n)=(n),g(n)=(n)andh(n)=(n).Theng(n)+f(n).h(n)is______

a. (n)
b.(n2 )
c.(n2 )
d.(n)

NotAttempt CorrectAns. a VideoSolution FAQ? Haveanydoubt? Solution

Q.19 Considerthegraphgivenbelow:

SupposeyouarerunningDijkstrasalgorithmstartingfromsourcevertexD.Whatwillbetheorderofverticeswhichwill
berelaxedusingDijkastrasalgorithm?

a. DFBHEGCA
b.DFBHGECA
c.DFBHEGAC
d.DFBEHGCA

NotAttempt CorrectAns. a FAQ? Haveanydoubt? Solution

Q.20 Considerthefollowingadjacencymatrix

Whichofthefollowingistransitiveclosureofthedirectedgraphdefinedbytheaboveadjacencymatrix?

a.

b.

c.

d.

NotAttempt CorrectAns. c FAQ? Haveanydoubt? Solution

Q.21 MatchListI(Dynamicalgorithm)withListII(Averagecaserunningtime)andselectthecorrectanswerusingthecodes
givenbelowthelists:
ListI(Dynamicalgorithm) ListII(Averagecaserunningtime)
A.Matrixchainmultiplication 1.(mn)

B.Travellingsalesmanproblem 2.(n3 )

C.0/1knapsack 3.(nn)
D.Fibonacciseries 4.(n)
Codes:
A B C D
(a) 1 3 2 4
(b) 1 3 3 2

https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName=timeManagementReport&testid=1221&t=cont1&testType=2 4/6
2/13/2017 MADEEASYONLINETESTSERIES

(c) 2 3 3 2
(d) 2 3 1 4

a.a
b.b
c.c
d. d

NotAttempt CorrectAns. d VideoSolution FAQ? Haveanydoubt? Solution

Q.22 ConsidertwoverticesaandbthataresimultaneouslyontheFIFOqueueatsamepointduringtheexecutionofbreadth
firstsearchfromsinanundirectedgraph.Considerthefollowingstatements:

S1 :Thenumberofedgesontheshortestpathbetweensandaisatmostonemorethanthenumberof
edgesontheshortestpathbetweensandb.
S2 :Thenumberofedgesontheshortestpathbetweensandaisatleastonelessthanthenumberof
edgesontheshortestpathbetweensandb.
S3 :Thereisaedgebetweenaandb.

Whichofthefollowingistrue?

a.S1 andS3 only


b.S1 andS2 only
c. S1 only
d.S1 ,S2 andS3

NotAttempt CorrectAns. c VideoSolution FAQ? Haveanydoubt? Solution

Q.23 LetG(V,E)beanundirectedgraphwithpositiveedgeweights.Whatistheworstcasetimecomplexitytofindminimum
spanningtreeusingKruskalalgorithmisimplementedusingarraydatastructure?

a.(|E|+|V|log|V|)
b. (|V|log|V|)
c.(|V|2 )
d.(|V|log2 |V|)

NotAttempt CorrectAns. b VideoSolution FAQ? Haveanydoubt? Solution

Q.24 Acertainproblemishavinganalgorithmwiththefollowingrecurrencerelation.

Howmuchtimewouldthealgorithmtaketosolvetheproblem?

a.

b.

c.

d.

NotAttempt CorrectAns. c FAQ? Haveanydoubt? Solution

Q.25 Considerthefollowingstatements
I.LetTbeaminimumspanningtreeofagraphG.Thenforanytwoverticesuandvthepathfromuto
vinTistheshortestpathfromutovinthegraphG.
II.SupposethataverageedgeweightforagraphGisAavg.ThentheminimumspanningtreeofGwill
haveweightatmost(n1)Aavg,wherenisnumberofverticesingraphG.
Whichoftheabovestatementsaretrue?

a.OnlyI
b.OnlyII
c.BothIandII
d. Noneofthese

NotAttempt CorrectAns. d FAQ? Haveanydoubt? Solution

Q.26 LetAisaMaxHeapwithheapsizelogn.AfunctionMHY(A,i,key)thatreplacesA[i]withagivenvaluekeyanditwill
adjustsothatresultbecomeMaxHeap.WhatistheworstcasetimecomplexitytoperformMHY(A,i,key)?

a. (loglogn)
b.(n)
c.(1)
d.(nlogn)

https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName=timeManagementReport&testid=1221&t=cont1&testType=2 5/6
2/13/2017 MADEEASYONLINETESTSERIES
NotAttempt CorrectAns. a VideoSolution FAQ? Haveanydoubt? Solution

Q.27 Considerthefollowingstatements:
S1 :Givenaminheapofheightlogn,itwilltake(logn)timetodeletetherootelementoftheheap.

S2 :TimecomplexityoffractionalKnapsackusinggreedyalgorithmis(n2 ).
S3 :Selectionsortworksongreedyapproach.
Whichofthefollowingoptioniscorrect

a.S1 andS2 arecorrect


b. S1 andS3 arecorrect
c.OnlyS1 iscorrect
d.OnlyS3 iscorrect

NotAttempt CorrectAns. b VideoSolution FAQ? Haveanydoubt? Solution

Q.28 Consider a procedure find ( ) which take array of n integers as input and produce pair of elements of array whose
differenceisnotgreaterthanthedifferenceofanyotherpairofelementofthatarray.Whichofthefollowingrepresent
worstcasetimecomplexityoffind()procedure?

a.(n)
b. (nlogn)
c.(n2 )
d.(n2 logn)

NotAttempt CorrectAns. b VideoSolution FAQ? Haveanydoubt? Solution

Q.29 Considerthehashingtablewithmslotsandnkeys.Iftheexpectednumberofprobesinunsuccessfulsearchis3.The
expectednumberofprobesinasuccessfulsearchis_______(upto2decimalplace).

NotAttempt CorrectAns. 1.647[1.642.00] FAQ? Haveanydoubt? Solution

Q.30 AssumethatanuppertriangularmatrixA[0...99,0...99]isstoredinalineararrayCofsize5050withrowmajororder.If
A[0,0]isstoredinC[0],findtheindexofCwhereA[70,90]isstoredinit.

NotAttempt CorrectAns. 4605 FAQ? Haveanydoubt? Solution

Q.31 Considerthefollowingstatementswithrespecttoquicksort.
S1 :Whileperformingsortingatanyiterationonly1elementcanbepresentatitscorrectposition.
S2 :Atfirstiteration,noneoftheelementchangesitsposition,iffgiveninputisalreadysorted.

S3 :Afterithiterationappliedonthesetofelementsleftafter(i1)iterations,ifanyelementisfoundtobe

atitscorrectposition,thenthatelementmusthavebeenthepivotfortheithiteration.
Thenumberofstatementsthataretrue__________.

NotAttempt CorrectAns. 0 VideoSolution FAQ? Haveanydoubt? Solution

Q.32 Themaximumnumberofordersinwhichwecaninsertelement{1,2,.....,7}intoanemptyAVLbinarytreesothatno
rotationneedtobeperformedonitare__________(Considerkeyofrootnodeis4always).

NotAttempt CorrectAns. 48 VideoSolution FAQ? Haveanydoubt? Solution

Q.33 A min heap having 1024 distinct elements with keys ranging from 0 to 1023 is stored in array of 1024 indices. The

maximum difference between the keys of all the element that can possibly be stored at index of the array is

__________.

NotAttempt CorrectAns. 1014 VideoSolution FAQ? Haveanydoubt? Solution

https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName=timeManagementReport&testid=1221&t=cont1&testType=2 6/6

You might also like