资源描述:
《微软2012暑期实习题》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、微软暑假实习生笔试题2012MicrosoftInternHiringWrittenTest1.SupposethataSelectionSortof80itemshascompleted32iterationsofthemainloop.Howmanyitemsarenowguaranteedtobeintheirfinalspot(nevertobemovedagain)?(A)16(B)31(C)32(D)39(E)402.WhichSynchronizationmechanism(s)is/a
2、reusedtoavoidraceconditionsamongprocesses/threadsinoperatingsystems?(A)Mutex(B)Mailbox(C)Semaphore(D)Localprocedurecall3.Thereisasequenceofnnumbers1,2,3,..,nandastackwhichcankeepmnumbersatmost.Pushthennumbersintothestackfollowingthesequenceandpopoutrand
3、omly.Supposenis2andmis3,theoutputsequencemaybe1,2or2,1,soweget2differentsequences.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.Whatistheresultofbinarynumber
4、01011001aftermultiplyingby0111001andadding1101110?(A)0001010000111111微软暑假实习生笔试题(B)0101011101110011(C)00110100001101015.Whatisoutputifyoucompileandexecutethefollowingcode?voidmain(){inti=11;intconst*p=&i;p++;printf("%d",*p);}(A)11(B)12(C)Garbagevalue(D)C
5、ompileerror(E)Noneofabove6.WhichoffollowingC++codeiscorrect?(A)intf(){int*a=newint(3);return*a;}(B)int*f(){inta[3]={1,2,3};returna;}(C)vectorf(){vectorv(3);returnv;}(D)voidf(int*ret){inta[3]={1,2,3};ret=a;return;}7.Giventhatthe180-degreerotate
6、dimageofa5-digitnumberisanother5-digitnumberandthedifferencebetweenthenumbersis78633,whatistheoriginal5-digitnumber?(A)60918(B)91086(C)18609(D)10968(E)869018.Whichofthefollowingstatementsaretrue?(A)Wecancreateabinarytreefromgiveninorderandpreordertraver
7、salsequences.(B)Wecancreateabinarytreefromgivenpreorderandpostordertraversalsequences.(C)Foranalmostsortedarray,insertionsortcanbemoreeffectivethanQuicksort.(D)SupposeT(n)istheruntimeofresolvingaproblemwithnelements,T(n)=Θ(1)ifn=1;T(n)=2T(n/2)+Θ(n)if>1;
8、soT(n)isΘ(nlogn).(E)Noneoftheabove.9.Whichofthefollowingstatementsaretrue?(A)Insertionsortandbubblesortarenoteffcientforlargedatasets.(B)QuicksortmakesO(n^2)comparisonsintheworstcase.(C)Thereisanarray:7,6,5,4,3,2,1.Ifusingselecti