资源描述:
《微软暑假实习生笔试题》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、2012MicrosoftInternHiringWrittenTest1.SupposethataSelectionSortof80itemshascompleted32iterationsofthemainloop.Howmanyitemsarenowguaranteedtobeintheirfinalspot(nevertobemovedagain)?(A)16(B)31(C)32(D)39(E)402.WhichSynchronizationmechanism(s)is/areusedtoavoidraceconditionsamongprocesses/t
2、hreadsinoperatingsystems?(A)Mutex(B)Mailbox(C)Semaphore(D)Localprocedurecall3.Thereisasequenceofnnumbers1,2,3,..,nandastackwhichcankeepmnumbersatmost.Pushthennumbersintothestackfollowingthesequenceandpopoutrandomly.Supposenis2andmis3,theoutputsequencemaybe1,2or2,1,soweget2differentsequ
3、ences.Supposenis7andmis5,pleasechoosetheoutputsequencesofthestack:(A)1,2,3,4,5,6,7(B)7,6,5,4,3,2,1(C)5,6,4,3,7,2,1(D)1,7,6,5,4,3,2(E)3,2,1,7,5,6,44.Whatistheresultofbinarynumber01011001aftermultiplyingby0111001andadding1101110?(A)0001010000111111(B)0101011101110011(C)00110100001101015.
4、Whatisoutputifyoucompileandexecutethefollowingcode?voidmain(){inti=11;intconst*p=&i;p++;printf("%d",*p);}(A)11(B)12(C)Garbagevalue(D)Compileerror(E)Noneofabove6.WhichoffollowingC++codeiscorrect?(A)intf(){int*a=newint(3);return*a;}(B)int*f(){inta[3]={1,2,3};returna;}(C)vectorf(){ve
5、ctorv(3);returnv;}(D)voidf(int*ret){inta[3]={1,2,3};ret=a;return;}7.Giventhatthe180-degreerotatedimageofa5-digitnumberisanother5-digitnumberandthedifferencebetweenthenumbersis78633,whatistheoriginal5-digitnumber?(A)60918(B)91086(C)18609(D)10968(E)869018.Whichofthefollowingstatemen
6、tsaretrue?(A)Wecancreateabinarytreefromgiveninorderandpreordertraversalsequences.(B)Wecancreateabinarytreefromgivenpreorderandpostordertraversalsequences.(C)Foranalmostsortedarray,insertionsortcanbemoreeffectivethanQuicksort.(D)SupposeT(n)istheruntimeofresolvingaproblemwithnelements,T(
7、n)=Θ(1)ifn=1;T(n)=2T(n/2)+Θ(n)if>1;soT(n)isΘ(nlogn).(E)Noneoftheabove.9.Whichofthefollowingstatementsaretrue?(A)Insertionsortandbubblesortarenoteffcientforlargedatasets.(B)QuicksortmakesO(n^2)comparisonsintheworstcase.(C)Thereisanarray:7,6,5,4,3,2,1.Ifusingselectionsort(ascending),th