You are on page 1of 9

5/5/2017 SinglyLinkedList~InterviewTopicsandQuestions

ThissiteusescookiesfromGoogletodeliveritsservices,topersonaliseadsandtoanalysetraffic.Information
aboutyouruseofthissiteissharedwithGoogle.Byusingthissite,youagreetoitsuseofcookies.

Interview Topics and Questions


LEARNMORE GOTIT
Search AdRoll 8051 Microcontroller Questions Get Yours

ChooseyourInterviewTopicstofaceachallengingITJob, Search AdRoll Vvdn Technologies Previous Papers Get Yours

HOME OBJECTIVEC INTERVIEWQUESTIONSON JOBOPENINGS FAQ'S DISCUSSIONFORUM EBOOKS

0
Like

SOCIALPROFILES
Tweet

0
Search

Interviews Topics FollowUs


1

Share

InterviewTopics
19,710likes

LikePage Share

Bethefirstofyourfriendstolikethis

HAPPYNEWYEAR2014
SinglyLinkedList
04:02 QUESTIONSonCanddatastructures Nocomments

MultipleChoice
1.Supposecursorpointstoanodeinalinkedlist.Whatstatementchangescursorsothatitpointsto
thenextnode?
1.cursor++
2.cursor=link()
3.cursor+=link()
4.cursor=cursor>link()

Ans.:d,thisstatementwillchangethecurrentpositionofthecursor.
2.Supposecursorpointstoanodeinalinkedlist.WhatBooleanexpressionwillbetruewhencursor
pointstothetailnodeofthelist?
1.(cursor == NULL)
2.(cursor->link( ) == NULL)
3.(cursor->data( ) == NULL)
4.(cursor->data( ) == 0.0)
5.Noneoftheabove.

Ans.:b,Onthelastnode,thelastnodeslinkwillbepointingtowardNULL,socursor>link()=>
Last_node>link
3.SupposethatpisapointervariablethatcontainstheNULLpointer.Whathappensifyourprogram
triestoreadorwrite*p?
1.Asyntaxerroralwaysoccursatcompilationtime.
2.Aruntimeerroralwaysoccurswhen*pisevaluated.
3.Aruntimeerroralwaysoccurswhentheprogramfinishes.
4.Theresultsareunpredictable.

Ans.:b,whenpisevaluated,aruntimeerroroccurs.
4.Supposethatfisafunctionwithaprototypelikethis:

void f(________ head_ptr);

// Precondition: head_ptr is a head pointer for a linked list.

http://interviewtopics.blogspot.co.uk/2012/05/singlylinkedlist.html#.WQvImEWGPIU 1/9
5/5/2017 SinglyLinkedList~InterviewTopicsandQuestions
// Postcondition: The function f has done some computation with
ThissiteusescookiesfromGoogletodeliveritsservices,topersonaliseadsandtoanalysetraffic.Information
the linked list, but the list itself is unchanged.
aboutyouruseofthissiteissharedwithGoogle.Byusingthissite,youagreetoitsuseofcookies.
//

LEARNMORE GOTIT
Whatisthebestdatatypeforhead_ptrinthisfunction?
1.node
2.constnode
3.node*
4.constnode*

Ans.:c,sincethelinkedlistisnotchanging,itdoesnotmattersifweacceptthenodeptrasa
0
formalargument
Like

5.Supposethatfisafunctionwithaprototypelikethis:
Tweet
void f(________ head_ptr);
0
// Precondition: head_ptr is a head pointer for a linked list.

// Postcondition: The function f has done some manipulation of


1
// the linked list, and the list might now have a new head node.
Share

Whatisthebestdatatypeforhead_ptrinthisfunction?
1.node
2.node&
3.node*
4.node*&

Ans.:d,sincethelinkedlistmightchange,wehavetoacceptitsaddressratherthanthenode
pointerassuch.

6.Whatistheexpressionforgeneratingapseudorandomnumberintherange1...N?
1.rand()%N
ReceiveEmailNotifications:
2.rand()/N
3.rand()%(N+1)
4.rand()/(N+1)
5.(rand()%N)+1 Subscribe

Ans.:e,itwillworkoutasthatalways.
MOSTRECENTINTERVIEWSHELD
7.Whichexpressioncomputesapseudorandomintegerbetween10and10usingrand()from
stdlib.h? CATechnologiesJobOpeningforFreshersin
1.(rand()%20)10
Hyderabad10/21/2014

2.(rand()%21)10
Honeywelljobopeningsfor
3.(rand()%22)10 freshers10/17/2014
4.(rand()%20)11
DELLJobOpeningsForFreshersOnOct
5.(rand()%21)11
201410/15/2014

Ans.:a,b,Bothgivenumbersbetween10and10. CognizantWalkinDriveOn18thOct
8.Whatkindoflistisbesttoanswerquestionssuchas"Whatistheitematpositionn?" 201410/14/2014
1.Listsimplementedwithanarray.
BankofamericaOpeningsforFreshers/ExpOn
2.Doublylinkedlists. Oct201410/13/2014
3.Singlylinkedlists.
4.Doublylinkedorsinglylinkedlistsareequallybest
POPULARTOPICS
Ans.:a,thelistimplementedusinganarray,becausearrayonlygivesinstantaccess.
ObjectiveCinterviewquestions

9.Linearorderlinkedlistisprovidedthrough_________
1.variables
VVDNTechnologiesinterviewquestions|VVDN
FAQ
2.arrays
3.Pointer
SinglyLinkedList
4.strings

MUSIGMAOffCampusDriveForFreshers
Ans)C

INTERVIEWTOPICS

10.InaSingleLinkList_________nodecontainsnolinks.
8051Microcontroller

1.First
Aptitudetips
2.Last
3.lastbutone cinterviewquestions
4.middle
CProgrammingexamples

http://interviewtopics.blogspot.co.uk/2012/05/singlylinkedlist.html#.WQvImEWGPIU 2/9
5/5/2017 SinglyLinkedList~InterviewTopicsandQuestions
Ans)B
CProgrammingChallenge
ThissiteusescookiesfromGoogletodeliveritsservices,topersonaliseadsandtoanalysetraffic.Information
aboutyouruseofthissiteissharedwithGoogle.Byusingthissite,youagreetoitsuseofcookies.
11.Alinkedlistiswhichtypeofdatastructure. ConceptsonCanddatastructures
1.Linear LEARNMORE GOTIT
2.NonLinear CPPConcepts
3.Hierarchical
interviewpreparationtips
4.None
interviewquestions
Ans)A
IphoneDevelopment

12.InSingleLinkedListanodecontainminimumhowmanyfields(assumingonefordata). iphoneinterviewquestions
0
1.2 Like
2.3 iphoneMaterial
3.1 Tweet
iphonesourcecodelibrary
4.None
0 iphonevideotutorial
Ans)A
ObjectiveCinterviewquestions

13.Implementationofpriorityqueue RTOS
1)Tree
1
2)Linkedlist VLSIINTERVIEWQUESTIONS
Share
3)Doublylinkedlist
1.1and2
2.2and3
3.1and3
4.All

Ans)B

14.Nullpointerisusedtotell
1)Endofthelinkedlist
2)Emptypointerfieldofastructure
3)Thelinkedlistisempty
1.1
2.2and3
3.1and3
4.All

Ans)A

15.Singlelinklistperformswhichofthefollowingmethods
1)Insertion
2)Modification
3)Searching
1.1and2
2.2and3
3.1and3
4.All

Ans)D

16.Thelistwithnonodeiscalledas
1)Emptylist
2)Nulllist
3)Zerolist
1.1and2
2.2and3
3.1and3
4.All

Ans)A

17.AnapplicationthatmakeuseofMultilinkedStructuresIs_________?
1.Sparsematrix
2.Linkedlist
3.Tree
4.Stack

Ans)A

http://interviewtopics.blogspot.co.uk/2012/05/singlylinkedlist.html#.WQvImEWGPIU 3/9
5/5/2017 SinglyLinkedList~InterviewTopicsandQuestions
18.Givenaarbitrarypointertoanelementinasinglylinkedlist,thetimecomplexityforitsdeletion
ThissiteusescookiesfromGoogletodeliveritsservices,topersonaliseadsandtoanalysetraffic.Information
___________.
aboutyouruseofthissiteissharedwithGoogle.Byusingthissite,youagreetoitsuseofcookies.
1.O(n/2)
2.O(n*n) LEARNMORE GOTIT
3.O(n)
4.O(n*n/2)

Ans)C

19.InClanguagetoimplementtheheterogeneouslinkedlist__________pointerisused.
1.Void
0
2.Null Like
3.Int
4.Structure Tweet

Ans)A 0

20.Searchingalinkedlistrequireslinkedlistbecreated
1.Insortedorderonly
1
2.Inanyorder
3.Withoutunderflowcondition
Share
4.None

Ans)B

21.Inlinkedlistthelogicalorderofelements
1.Issameastheirphysicalarrangement
2.Isnotnecessarilyequivalenttotheirphysicalarrangement
3.Isdeterminedbytheirlogicalarrangement
4.None

Ans)B

22.AccordingtoStoragestrategiesLinkedlistisa
1.Nonlinear
2.Linear
3.Sequential
4.dynamic

Ans:a

23.Implementationofalistinadynamicfashionis
1.Tocalluponthesystemtoallocateandfreestoragemaynotbetimeconsuming
2.Asetofnodesnotreservedinadvanceforuse
3.Theaddresscomputationiscomplex
4.None

Ans)B

24.IfyouareusingClanguagetoimplementaheterogeneouslinkedlist,thepointertypeuwillpreferis
________
1.int*
2.Null
3.void*
4.float*

Ans)C

25.Whichofthefollowingstatementistrue
a. Thenextaddressfieldofthenodecanbeempty
b. Alistcanexistwithnonodes
c. Inasinglylinkedlistthestartingaddressofthelistisstoredintheaddressfieldofthelast
node
d.Alloftheabove

Ans:b,Alistwithnonodesiscalledemptylistornulllist

26.TypeofstorageisusedtorepresentLists

http://interviewtopics.blogspot.co.uk/2012/05/singlylinkedlist.html#.WQvImEWGPIU 4/9
5/5/2017 SinglyLinkedList~InterviewTopicsandQuestions
1.Random
ThissiteusescookiesfromGoogletodeliveritsservices,topersonaliseadsandtoanalysetraffic.Information
2.Sequential
aboutyouruseofthissiteissharedwithGoogle.Byusingthissite,youagreetoitsuseofcookies.
3.Dynamic
4.Logical LEARNMORE GOTIT

Ans:c,page187tenenbaum

27.Thenodeinasinglylinkedlistcanbedeleted,
a. Withouttraversingthelist
b.Bytraversingthelistfromthehead
c. Bytraversingthelistfromthetail
0
d.
Like Alloftheabove

Tweet
Ans:b

0
28.Whichofthefollowingoperationsisnotefficientlysupported
byasinglylinkedlist?
a.accessingtheelementinthecurrentposition
1b.insertionafterthecurrentposition
c.insertionbeforethecurrentposition
Share
d.movingtothepositionimmediatelyfollowingthecurrentposition

Ans:c

29.Whatisanorderedlist
a. wheretheaddressisordered
b. wherethesmalleritemsprecedethelargerones
c. bothaandb
d. none
Ans:b

30.AccordingtoAccessstrategiesLinkedlistisa
a. Nonlinear
b. Linear
c. Sequential
d. dynamic
Ans:b
31.Howmanynodesareaccessed,ontheaverage,ininsertinganewelementintoanorderedlistwithn
nodes
a.(n+1)/2
b.n/2
c.1/(n+1)
d.None

Ans:b,page200ofTenenbaum2nd edition

32.ApriorityQueueimplementedasanorderedlinkedlistrequiresexaminingan
averageofapproximately_______nodesforinsertion
a.(n+1)/2
b.1/(n+1)
c.n/2
d.one

Ans:c,page200ofTenenbaum2nd edition

33.ApriorityQueueimplementedasanorderedlinkedlistrequiresexaminingan
averageofapproximately_______nodesfordeletion
a.(n+1)/2
b.1/(n+1)
c.n/2
d.one

Ans:d,page200ofTenenbaum2nd edition

34.Theadvantageoflistsoveranarrayforimplementingapriorityqueueis
a.Extraspaceshouldbeleftemptyintheendtoachievethis
b.Listswilltakelesstimecomparedtoarrays
c.Noshiftingofelementsorgapsarenecessaryinalist
d.Listsdonthavedirectaccess

Ans:c,page200ofTenenbaum2nd edition

http://interviewtopics.blogspot.co.uk/2012/05/singlylinkedlist.html#.WQvImEWGPIU 5/9
5/5/2017 SinglyLinkedList~InterviewTopicsandQuestions
35.Anitemcanbeinsertedinto______,withoutmovinganyotheritems
ThissiteusescookiesfromGoogletodeliveritsservices,topersonaliseadsandtoanalysetraffic.Information
a.List
aboutyouruseofthissiteissharedwithGoogle.Byusingthissite,youagreetoitsuseofcookies.
b.anarrayifextraspaceisleftempty
c.bothaandb LEARNMORE GOTIT
d.none

Ans:b,page200ofTenenbaum2nd edition

36.Anextranodeatthefrontofthelist,whichdoesnotrepresentaniteminthelistis
Called
a.headernode
b.Listnode
0
c.Listheader
Like

d.Bothaandc
Tweet
Ans:d,page200ofTenenbaum2nd edition

37)A__________isaselfreferentialdatatypebecauseitcontainsapointerorlinktoanotherdataofthe
sametype.
1
1.Stack
2.LinkedlistShare
3.Queue
4.Priorityqueue

Ans)B
Exp)ALinkedlistisaselfreferentialdatatypebecauseitcontainsapointerorlinktoanotherdataofthe
sametype.
Formorerefertohttp://en.wikipedia.org/wiki/Linked_list

38)Linkedlists,atanypointinthelistinconstanttime,doesnotallow__________.
1.Randomaccess.
2.Insertion
3.Deletion
4.Insertionatend

Ans)A
Exp)Linkedlistspermitinsertionandremovalofnodesatanypointinthelistinconstanttime,butdonotallowrandom
access.Formorerefertohttp://en.wikipedia.org/wiki/Linked_list

39)__________permitsinsertionandremovalofnodesatanypointinthelistinconstanttime,butdonotallow
randomaccess
1.Stack
2.Linkedlist
3.Queue
4.Priorityqueue

Ans)B
Exp)Linkedlistspermitinsertionandremovalofnodesatanypointinthelistinconstanttime,butdonotallow
randomaccess.Formorerefertohttp://en.wikipedia.org/wiki/Linked_list

40)Totraversea___________,youbeginatanynodeandfollowthelistineitherdirectionuntilyou
returntotheoriginalnode.
1.Doublylinkedlist
2.Twowaylinkedlist
3.Circularlinkedlist
4.Singlylinkedlist

Ans)C
Youbeginatanynodeandfollowthelistineitherdirectionuntilyoureturntotheoriginalnode,totraversea
circularlinkedlist.Doublylinkedlistsandtwowaylinkedlistsarethesame.Formorereferto
http://en.wikipedia.org/wiki/Linked_list

41)Thepointer,incaseofacircularlinkedlist,pointingtothewholelistisusuallycalledthe___________.
1.Doublepointer
2.Listpointer
3.Circularpointer
4.Endpointer

Ans)D

http://interviewtopics.blogspot.co.uk/2012/05/singlylinkedlist.html#.WQvImEWGPIU 6/9
5/5/2017 SinglyLinkedList~InterviewTopicsandQuestions
Thepointer,incaseofacircularlinkedlist,pointingtothewholelistisusuallycalledtheendpointer.Formore
ThissiteusescookiesfromGoogletodeliveritsservices,topersonaliseadsandtoanalysetraffic.Information
refertohttp://en.wikipedia.org/wiki/Linked_list
aboutyouruseofthissiteissharedwithGoogle.Byusingthissite,youagreetoitsuseofcookies.
42)Ina______________,eachnodehasonelink,similarlytoanordinarysinglylinkedlist,exceptthatthenext
LEARNMORE GOTIT
linkofthelastnodepointsbacktothefirstnode.
1.Doublylinkedlist
2.Singlycircularlylinkedlist
3.Doublycircularlinkedlist
4.Twowaylinkedlist

Ans)B
0
Eachnodehasonelink,similarlytoanordinarysinglylinkedlist,exceptthatthenextlinkofthelastnodepoints
Like

backtothefirstnode,inasinglycircularlylinkedlist.Formorerefertohttp://en.wikipedia.org/wiki/Linked_list
Tweet

43)Ina______________,eachnodehastwolinks,similarlytodoublylinkedlist,exceptthatpreviouslinkofthe
0
firstnodepointstothelastnodeandthenextlinkofthelastnodepointstothefirstnode.
1.Doublycircularlylinkedlist
2.Doublylinkedlist
3.Singlycircularlylinkedlist
1
4.Twowaylinkedlist

Share
Ans)A
Eachnodehastwolinks,similarlytodoublylinkedlist,exceptthatpreviouslinkofthefirstnodepointstothelast
nodeandthenextlinkofthelastnodepointstothefirstnode
inadoublycircularlylinkedlist.Formorerefertohttp://en.wikipedia.org/wiki/Linked_list

44)Ina__________,insertionsandremovalscanbedoneatanypointwithaccesstoanynearbynode.
1.Doublycircularlylinkedlist
2.Doublylinkedlist
3.Singlycircularlylinkedlist
4.Twowaylinkedlist

Ans)B
Formorerefertohttp://en.wikipedia.org/wiki/Linked_list

45)_______________aremostusefulfordescribingnaturallycircularstructures,andhavetheadvantageof
regularstructureandbeingabletotraversetheliststartingatanypoint.
1.Doublylinkedlist
2.Twowaylinkedlist
3.Singlylinkedlist
4.Circularlinkedlist

Ans)D

46)Whichofthefollowingoperationsisnotefficientlysupportedbyasinglylinkedlist?
a.Accessingtheelementinthecurrentposition
b.Insertionafterthecurrentposition
c.Insertionbeforethecurrentposition
d.Movingtothepositionimmediatelyfollowingthecurrentposition
e.Alloftheaboveareefficientlysupported
Ans.:c,Toinsertbeforethecurrentpositionanotherpointerhastobemadetopointtothe
positionbeforethecurrentposition.

47)Theheadernodeofalinkedlist
(a)Simplifiesdeletion
(b)Simplifiesinsertion
(c)Pointstonull
(d)Both(a),(b)
Ans)D

48)Ifaheadernodeisused,whichofthefollowingindicatesalistLwithoneitem?
(a)L.Header.Next=null
(b)L.Header.Next/=null
(c)L.Header.Next/=nullandthenL.Header.Next.Next/=null
(d)L.Header.Next/=nullandthenL.Header.Next.Next=null
(e)Noneoftheabove

Ans)D

http://interviewtopics.blogspot.co.uk/2012/05/singlylinkedlist.html#.WQvImEWGPIU 7/9
5/5/2017 SinglyLinkedList~InterviewTopicsandQuestions
49)InsertionofanodeintoadoublylinkedlistrequireshowmanychangestovariousNext
ThissiteusescookiesfromGoogletodeliveritsservices,topersonaliseadsandtoanalysetraffic.Information
andPrevpointers?
aboutyouruseofthissiteissharedwithGoogle.Byusingthissite,youagreetoitsuseofcookies.
(a)Nochanges
(b)1Next,1Prev LEARNMORE GOTIT
(c)2Next,2Prev
(d)3Next,3Prev
(e)Noneoftheabove
Ans)C

50)Whatoperationissupportedinconstanttimebythedoublylinkedlist,butnotbythe
singlylinkedlist?
0

(a)Advance Like
(b)MovebackTweet
(c)First
(d)Retrieve 0
(e)Alloftheabovearealwaysconstanttime

Ans)B,DoublylinkedlisthastwopointerspointingtoforwardandbackwardSimultaneously
1
51)Considerthefollowingstatements.
Share
(i)Alinkedlistconsistsofaseriesofstructures,whicharenecessarilyadjacentinmemory.
(ii)Inasinglylinkedlist,eachstructurecontainsanelementandareferencetoarecordcontainingitssuccessor.
(iii)Inanarraybasedlist,evenifthearrayisdynamicallyallocated,anestimateofthemaximumsizeofthelistisrequired.
(iv)Inanarraybasedlist,insertingatposition0requiresfirstpushingtheentirearraydownonespottomakeroom.
(v)Inanarraybasedlist,deletingelementsfromthemiddlecanbeperformedwithoutshiftingtheremainingelements.
Whichoftheabovestatementsis/arevalidforalist?
1.(ii)&(iv)only
2.(ii),(iii)&(iv)only
3.(iii),(iv)&(v)only
4.(ii)&(iv)only
5.(ii),(iii),(iv)&(v)only

Ans)B

52)Considerthefollowingoperations.
(i)Appendanelementtotheendofalist.
(ii)Concatenatetwolists.
(iii)Freeallthenodesinalist.
(iv)Reversealist,sothatthelastelementbecomesthefirstandsoon.
(v)Deletethelastelementfromalist.
(vi)Deletethenthelementfromalistwithatleastnelements.
(vii)Combinetwoorderedlistsintoasingleorderedlist.
Whichoftheabovearevalidoperationsinsinglylinkedlists?
1.(i),(ii),(iii),(v),(vi)&(vii)
2.(iii),(iv),(v),(vi)&(vii)
3.(i),(ii),(iii),(iv),(vi)&(vii)
4.(i),(ii),(iii),(iv)&(vii)
5.(i),(ii),(iii),(iv),(v),(vi)&(vii)

Ans)E

53)Considerthefollowingalgorithm.
(i)Anemptynodeiscreated.
(ii)Thenodesinformationfieldisinitializedtoanintegere1.
(iii)Thenodeisbeingincludedattheendofthelist,andthenextfieldissettonull.
(iv)Thenodeisnowincludedinthelistbymakingthenextfieldofthelastnodeofthelistareferencetothenewlycreated
node.
(v)Thenewnodefollowsallthenodesofthelist,butthisfacthastobereflectedinthevalueofthetail,whichnowbecomesthe
referencetothenewnode.
Whichofthefollowingdoestheabovealgorithmdescribe?
1.Theprocessofaddinganewnodetothelastnodeofthetree
2.Theprocessofaddinganewnodetoanylocationofthelist
3.Theprocessofaddinganewnodetotheendofthelist
4.Theprocessofdeletinganodefromtheendofthelist
5.Theprocessofdeletinganodefromthebeginningofthelist

Ans)C

http://interviewtopics.blogspot.co.uk/2012/05/singlylinkedlist.html#.WQvImEWGPIU 8/9
5/5/2017 SinglyLinkedList~InterviewTopicsandQuestions

ThissiteusescookiesfromGoogletodeliveritsservices,topersonaliseadsandtoanalysetraffic.Information
aboutyouruseofthissiteissharedwithGoogle.Byusingthissite,youagreetoitsuseofcookies.
LEARNMORE GOTIT

Recommend this on Google

NewerPost Home OlderPost

0comments:
0
Like
PostaComment

Tweet

0
Enteryourcomment...

1
Commentas: Selectprofile...
Share

Publish
Preview

Subscribeto:PostComments(Atom)

Copyright2011InterviewTopicsandQuestions|PoweredbyBlogger

DesignbyNewWpThemes|BloggerThemebyLasanthaPremiumBloggerThemes|VirtualPrivateServer

http://interviewtopics.blogspot.co.uk/2012/05/singlylinkedlist.html#.WQvImEWGPIU 9/9

You might also like