版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
?▓中山大學(xué)本科生期末考試試?▓中山大學(xué)軟件學(xué)院本科生期末考試考試科目:《數(shù)據(jù)庫(kù)系統(tǒng)原理》(A卷)學(xué)年學(xué)期:2014學(xué)年第3學(xué)期學(xué)院/系:軟件學(xué)院考試方式:開(kāi)卷考試時(shí)長(zhǎng):120分鐘
姓名:學(xué)號(hào):班別:警示以下為試題區(qū)域,共7道大題,總分100分,考生請(qǐng)?jiān)诖痤}紙上作答(10marks)LetR={A,B,C,D,E,F,G}andF=BC,GF}.Answerthefollowingthreequestions.(4marks)ComputetheminimalcoverofF.BCACAEEFGGF(4marks)DecomposeRinto3NFrelations.{B,C},{A,C,E},{E,F,G}and{A,B,D,F}(OR{A,B,D,G})(2marks)Isthecompositionin(b2)inBCNF?Brieflyexplainyouranswer.No.For{E,F,G}andGF,Gisnotacandidatekey.?▓?▓中山大學(xué)本科生期末考試試?▓(10marks)AssumethereisanemployeedatabaseEmployee(eid:8bytes,ename:16bytes,did:4bytes,email:12bytes),whereeidandenamearerespectivelytheidandnameofanemployeeanddidistheidofthedepartmentinwhichtheemployeeworks.Supposethereare50,000employeerecordsand500departments(i.e.eachdepartmenthas100employeesonaverage).Apagesizeis1,000bytesandapointercosts4bytes.(4marks)Assumethattheemployeefileissortedsequentiallyondidandthereisnoindex.Estimatethepageaccesscostforretrievingtherecordsofallemployeesworkinginadepartmentwithagiven did.(Youshouldshowyourargumentandthemainstepsoftheestimationclearlyintheanswer.)AnswerRecordsize=40bytes,25recordsperpage,2,000pages.Findingthefirstrecordrequires+3morepagestosearchremainingrecords(eachdepthas100employeeswhicharedistributedin4pages).(6marks)Assumeonly20pagesofmainmemoryareavailableforrunningexternalsortingoftheemployeefileondid.HowmanyPASSesareneededfortheexternalsorting?IneachPASS,howmanyrunsarecreated?Whatisthetotalcostofthesortingintermsofpages?Answer:3PASSes:PASS0:2000pages/20pagesperrun=100runsPASS1:ceil(100runs/19runsperrun)=6runsPASS2:1runTotalcost:(2000pagesreadperpass+2000pageswriteperpass)*2PASSes+2000pagesreadperpass=10000pages(Note:Outputisnotcounted!)Or: 2000*(2*2+1)=10000pagestransfer.(10marks)SupposeabookstorehasthefollowingfiverelationalBOOK(BID,TITLE,AID,SUBJECT,QUANTITY_IN_STOCK)7710152015791013151720252930AUTHOR(AID,NAME)CUSTOMER(CID,NAME)ORDER_DETAILS(OID,BID,QUANTITY)ORDER(OID,CID,ORDER_YEAR)Intheabovetables,keysareunderlinedandforeignkeysareinitalics. Eachauthorauthoredatleastonebookinthestore.Eachbookhasexactlyoneauthor.EachorderismadebyexactlyonecustomerandhasoneormoreassociatedrecordinORDER_DETAILS(e.g.,anordermaycontaindifferentbooks).Expressthefollowingqueryusing(i)SQLexpressions,(ii)therelationalalgebra(RA).FindthedistinctcustomerIDs(CID)ofcustomerswhohavepurchasedmorethan10identicalbooksinoneorderatleastonce.SELECTDISTINCTCIDFROMORDER_DETAILSod,ORDERoWHEREQUANTITY>=10ANDod.OID=CID(σQUANTITY≥10(ORDER_DETAILS OIDORDER))(10marks)AB+treewithn=5isshowninFigure1,inwhichonlysearchkeysareshownandpointerstothefilesystemarehidden.Wewanttoinsertadataentrywithsearchkey“23”.Figure1.AB+TreeStructureWhichofthefollowingdescriptionsabouttheinsertionoperationiscorrect?TheB+treecontains2levelsafterinsertion.2nodesplitsareneededduringinsertion.Therootnodecontainssearchkey“15”.TheB+treecontains3levelsafterinsertion.1nodesplitisneededduringinsertion.Therootnodecontainssearchkey“20”.TheB+treecontains3levelsafterinsertion.2nodesplitsareneededduringinsertion.Therootnodecontainssearchkey“15”.TheB+treecontains3levelsafterinsertion.2nodesplitsareneededduringinsertion. Therootnodecontainssearchkey“20”.Answer:CWewanttodeletethedataentrywithsearchkey“7”.Howmanyleafnodesstoreonlytwodatavaluesafterdeletion?2345Answer:(20marks)Youaregivenaninitialhashstructurewiththreekeysalreadyinsertedasbelow.Thehashfunctionish(x)=xmod16.DrawfiveextendablehashstructurescorrespondingforeachinsertionofthefollowingsearchkeyvaluesK:7,15,20,37,18.Assumeeachbucketcanholdtwokeysandthesearchkeyvaluesarriveinthegivenorder(i.e.7beingthefirstcomingkeyand18beingthelastone).Youshouldfollowtheconventionusedbylectureslides:binaryhashindicesstartingfromtheleastsignificantbit.(E.g.1istheleastsignificantbitofthe4digitbinarynumber0001.)11101411172521002100140110211172527Insert15and2021001420011021117252715Insert373310001420001010301117251003101371101112715Insert183320002000120100111418100310117251101113372715(25Marks)ConsideradatabaseconsistingofthefollowingthreerelationSAILORS(sid,sname,rating,age)BOATS(bid,bname,color)RESERVES(sid,bid,date,rname)Themeaningoftheattributesintheaboveschemasisself-explanatory.Forexample,sidisthesailoridentitynumberandbnameisthenameoftheboat.Theprimarykeysoftherelationsareunderlined.TheattributesidinRESERVESisaforeignkeyreferencingSAILORS.TheattributebidinRESERVESisaforeignkeyreferencingBOATS.TherelationSAILORShas100,000tuplesand100tuplesofSAILORSfitintoonepage.relationBOATShas50,000tuplesand25tuplesofBOATSfitintoone page.TheRESERVEShas10,000tuplesand20tuplesofRESERVESfitononepage.Weassumeallattributevaluesandpointersin thesethreerelations,ifneededto beconsidered,areofsamesize.(10marks)AssumethatweuseIndexedNestedLoopJointocomputeSAILORSRESERVESusingSAILORSastheouterrelation.RESERVEShaveprimaryB+-treeindexwith2levelsonthejoinattribute.Estimatethecostofthejoinintermsofpages.NumberofSAILORSpages:br=100,000/100=1,000NumberofSAILORSTuples:nr=100,000.Thecostisbr+c*nr=1,000+(2+1)*100,000=301,000.(5mark)Assumethat26%ofthesailorshavetheratingbiggerthan5.Estimateresultsizeof sid(σrating>5SAILORS)intermsofpages.Size=26%*100,000/100/4=65pages260dividedby4,forthereisprojectionandalltheattributeshavesamesize(10marks)ConsiderthefollowingtwostrategiestocomputethejoinoperationSAILORS BOATS RESERVES.Strategy1:(SAILORSBOATS)RESERVESStrategy2:(SAILORSRESERVES) Whichstrategyisbetter?Explainthereason(s)ofyourchoicebasedonthesizeoftheintermediateresultusingtheabovestrategies.Strategy2isbetter.BecauseinStrategy1,SAILORSBOATSisequaltothecross-productoftherelationsandthesizeofthejoinresultwillbecomeaslargeas100,000*50,000=5,000,000,000tuples.ThisintermediateresultisverylargeandlaterwhenjoiningintermediateresultwithRESERVES,thecostisalsolarge.Incomparison,inStrategy2,SAILORSRESERVEShasonly10,000tuples.AndlaterwhenjoiningthisintermediateresultwithBOATS,thecostisalsosmall.(15Marks)ConsiderascheduleSwhichconsistsoffourtransactionsasfollows:S=<T3_R(U),T2_R(X),T2_W(X),T3_R(X),T1_R(Y),T1_W(Y),T3_W(X),T1_R(Z),T4_R(Z),T4_W(Z),T2_W(Y),T3_R(Y)>Thenotationisself-explanatory.Forexample,T1_R(X)meansthattransactionT1readsitemX.(5marks)FillinthefollowingtablerepresentingSwiththeusualnotationsinlectureslides.ThefirstoperationR(U)hasbeenshowninthetable.Showclearlyallconflictingpairswithdownwardarrowsontheoperations.T1T1T2T3R(U)T4R(X)W(X)R(X)R(Y)W(Y)W(X)R(Z)R(Z)W(Z
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 安全員A證考試考前沖刺分析及參考答案詳解【b卷】
- 2022上半年教師資格證中學(xué)教育知識(shí)與能力試卷及答案1
- 安全員A證考試考前自測(cè)高頻考點(diǎn)模擬試題附完整答案詳解(全優(yōu))
- 審計(jì)考試題目及答案
- 設(shè)備兩源改善培訓(xùn)課件
- 行政事務(wù)實(shí)操考試題庫(kù)及答案
- 安全員A證考試考試彩蛋押題及參考答案詳解【b卷】
- 2025年春季人力資源管理師二級(jí)考試真題試卷及答案
- 2025年安全員A證考試真題匯編【典優(yōu)】附答案詳解
- 醫(yī)學(xué)統(tǒng)計(jì)學(xué)模擬試卷及答案
- 2025年冷水機(jī)組考試題庫(kù)及答案
- 超聲科工作總結(jié)與計(jì)劃
- 旅居養(yǎng)老策劃方案
- T-CRHA 089-2024 成人床旁心電監(jiān)測(cè)護(hù)理規(guī)程
- DBJ52T 088-2018 貴州省建筑樁基設(shè)計(jì)與施工技術(shù)規(guī)程
- 專題15 物質(zhì)的鑒別、分離、除雜、提純與共存問(wèn)題 2024年中考化學(xué)真題分類匯編
- 小區(qū)房屋維修基金申請(qǐng)范文
- 中職高二家長(zhǎng)會(huì)課件
- 復(fù)方蒲公英注射液在痤瘡中的應(yīng)用研究
- 淮安市2023-2024學(xué)年七年級(jí)上學(xué)期期末歷史試卷(含答案解析)
- 家長(zhǎng)要求學(xué)校換老師的申請(qǐng)書
評(píng)論
0/150
提交評(píng)論