2022年吉大數(shù)據(jù)庫(kù)應(yīng)用技術(shù)在線作業(yè)一答案_第1頁(yè)
2022年吉大數(shù)據(jù)庫(kù)應(yīng)用技術(shù)在線作業(yè)一答案_第2頁(yè)
2022年吉大數(shù)據(jù)庫(kù)應(yīng)用技術(shù)在線作業(yè)一答案_第3頁(yè)
2022年吉大數(shù)據(jù)庫(kù)應(yīng)用技術(shù)在線作業(yè)一答案_第4頁(yè)
2022年吉大數(shù)據(jù)庫(kù)應(yīng)用技術(shù)在線作業(yè)一答案_第5頁(yè)
已閱讀5頁(yè),還剩6頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、吉大數(shù)據(jù)庫(kù)應(yīng)用技術(shù)在線作業(yè)一答案試卷總分:100測(cè)試時(shí)間:-試卷得分:100單選題一、單選題(共25道試題,共100分。)得分:100V1.Giventhefollowingtable:TestTableC1-12345AndifthefollowingCLIcallsaremade:SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&henv);SQLSetEnvAttr(henv,SQL_ATTR_ODBC_VERSION,(SQLPOINTER)SQL_OV_ODBC3,0);SQLAllocHandle(SQL_HANDLE_DBC,henv,

2、&hdbc);SQLConnect(hdbc,(SQLCHAR*)db,SQL_NTS,(SQLCHAR*)userid,SQL_NTS,(SQLCHAR*)password,SQL_NTS);SQLSetConnectAttr(hdbc,SQL_ATTR_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF,0);SQLAllocHandle(SQL_HANDLE_STMT,hdbc,&hstmt);SQLPrepare(hstmt,(unsignedchar*)select*fromTestorderbyC1,SQL_NTS);SQLBindCol(hstmt,1,SQL_C_SHO

3、RT,&data,0,NULL);SQLExecute(hstmt);SQLFetch(hstmt);printf(Data:%in,data);SQLFetch(hstmt);printf(Data:%in,data);SQLFetch(hstmt);printf(Data:%in,data);SQLEndTran(SQL_HANDLE_ENV,henv,SQL_COMMIT);SQLFetch(hstmt);printf(Data:%in,data);Whichofthefollowingwillbereturnedbytheprogram?A.Data:1Data:2Data:3Data

4、:3B.Data:1Data:2Data:3Data:4C.Data:1Data:2Data:3Data:1D.Data:1Data:2Data:3Data:5滿分:4分得分:42.Giventhecode:EXECSQLDECLAREcursor1CURSORFORSELECTname,age,b_dateFROMperson;EXECSQLOPENcursor1;Underwhichofthefollowingsituationswilltheabovecursorbeimplicitlyclosed?A.WhenaCLOSEstatementisissuedB.WhenaCOMMITst

5、atementisissuedC.WhentherearenorowsintheresultsetD.WhenallrowsareFETCHedfromtheresultset滿分:4分得分:43.Giventheapplicationcode:EXECSQLDECLAREcurCURSORWITHHOLDFORSELECTc1FROMt1EXECSQLOPENcurEXECSQLFETCHcurINTO:hv/*Statement1*/EXECSQLCOMMIT/*Statement2*/EXECSQLFETCHcurINTO:hv/*Statement3*/EXECSQLROLLBACK/

6、*Statement4*/EXECSQLCLOSEcur/*Statement5*/IfthetableT1hasnorowsinit,whichstatementwillcausethecursorcurtobeclosedfirst?A.Statement1B.Statement2C.Statement3D.Statement4滿分:4分得分:44.HowmanyrowscanberetrievedusingasingleSELECTINTOstatement?A.OnlyonerowB.AsmanyasareintheresultC.Asmanyasarehostvariablesuse

7、dinthecallD.Asmanyashostvariablearraystructurescanhold滿分:4分得分:45.GiventhetableT1withthefollowingdata:COL1IDX-Asingle-threadedCLIapplicationexecutesthefollowingpseudocodeinsequence:SQLAllocHandle(SQL_HANDLE_ENV,NULL,&hEnv)SQLAllocHandle(SQL_HANDLE_DBC,hEnv,&hDbc)SQLConnect(hDbc,SAMPLE,SQL_NTS,NULL,SQ

8、L_NTS,NULL,SQL_NTS)SQLSetConnectAttr(hDbc,SQL_ATTR_AUTOCOMMIT,SQL_AUTOCOMMIT_ON)SQLAllocHandle(SQL_HANDLE_STMT,hDbc,&hStmt)SQLExecDirect(hStmt,UPDATEtable1SETcol1=10WHEREidx=1,SQL_NTS)SQLExecDirect(hStmt,UPDATEtable1SETcol1=20WHEREidx=2,SQL_NTS)SQLEndTran(SQL_HANDLE_DBC,hDbc,SQL_COMMIT)SQLExecDirect

9、(hStmt,UPDATEtable1SETcol1=30WHEREidx=1,SQL_NTS)SQLExecDirect(hStmt,UPDATEtable1SETcol1=40WHEREidx=1,SQL_NTS)SQLEndTran(SQL_HANDLE_DBC,hDbc,SQL_ROLLBACK)SQLExecDirect(hStmt,SELECTcol1FROMtable1WHEREidx=1,SQL_NTS)WhichofthefollowingvaluesforCOL1willbefetchedwhenthesequenceforthepseudocodelistedabovei

10、ssuccessfullyexecuted?A.10B.20C.30D.40滿分:4分得分:46.GiventhetableT1withthefollowingdata:C1C2-1122AnapplicationissuesthefollowingSQLstatementswithAUTOCOMMITdisabled:UPDATEt1SETc1=10WHEREc2=1UPDATEt1SETc1=20WHEREc2=2SAVEPOINTsp1UPDATEt1SETc1=30WHEREc2=1UPDATEt1SETc1=40,c2=3WHEREc2=2SAVEPOINTsp1UPDATEt1SE

11、Tc1=50WHEREc2=1UPDATEt1SETc1=60WHEREc2=2ROLLBACKTOSAVEPOINTsp1UPDATEt1SETc1=50WHEREc2=3COMMITWhatistheresultofthefollowingquery?SELECTc1,c2FROMt1ORDERBYc2A.101202B.301503C.301403D.101503滿分:4分得分:47.Whichofthefollowingcursordefinitionswilldefineacursorcalledc2thatwillfetchrowsfromtablet2,andforeveryro

12、wfetchedwillupdatecolumnc1intablet2?A.DECLAREc2CURSORFORSELECT*FROMt2FORUPDATEOFt2B.DECLAREc2CURSORFORSELECT*FROMt2FORUPDATEOFc2C.DECLAREc2CURSORFORSELECT*FROMt2FORUPDATEOFc1D.DECLAREc2CURSORWITHHOLDFORSELECT*FROMt2FORUPDATEOFt2滿分:4分得分:48.GivenanODBC/CLIprogramwithasingleconnection,twothreadsandthef

13、ollowingactionswhichcompletesuccessfully:Thread1:INSERTINTOmytabVALUES(1)Thread2:INSERTINTOmytabVALUES(2)Thread1:COMMITThread2:INSERTINTOmytabVALUES(3)Thread1:ROLLBACKThread2:COMMITHowmanyrecordswillbeinsertedandretainedinthetableMYTAB?A.0B.1C.2D.3滿分:4分得分:49.Giventhefollowingcode:EXECSQLEXECUTEIMMED

14、IATE:sqlstmtWhichofthefollowingvaluesmustsqlstmtcontainsothatallrowsaredeletedfromtheSTAFFtable?A.DROPTABLEstaffB.DELETEFROMstaffC.DROP*FROMstaffD.DELETE*FROMstaff滿分:4分得分:410.Giventheexpression:WITHmost_citiesAS(SELECTb.id,,a.citiesFROMcountrya,staffbWHEREa.person=b.idANDcities:threshold)SELEC

15、T*FROMmost_citiesInwhichofthefollowingdoesMOST_CITIESexist?A.usertablesB.servermemoryC.usertablespaceD.systemcatalogtables滿分:4分得分:411.Giventhefollowingstatements:EXECSQLINSERTINTOemployeeVALUES(:new_emp,:new_name)EXECSQLUPDATEcompanySETnum_employees=num_employees+1WHEREcompany_id=1EXECSQLCOMMITWhich

16、ofthefollowingcanbeaddedtothedatabasesothatthecompanytablewillstillbeupdatedwithouttheneedfortheexplicitUPDATESQLstatement?A.AnINSERTtriggeronCOMPANYB.AnUPDATEtriggeronCOMPANYC.AnINSERTtriggeronEMPLOYEED.AnUPDATEtriggeronEMPLOYEE滿分:4分得分:412.Whichofthefollowingproducesasequentiallyincreasingnumber,su

17、itableforuseasaprimarykey?A.ROWIDdatatypeB.GeneratedIDENTITYcolumnC.GENERATE_UNIQUEbuilt-infunctionD.CURRENTSEQUENCEspecialregister滿分:4分得分:413.AcursorisdeclaredwiththeWITHHOLDoption.Whichofthefollowingstatementsisalwaystrue?A.ThecursorwillremainopenafteraCOMMIT.B.AllrowsretrievedarelockeduntilaCOMMI

18、T.C.ACOMMITwillnotbealloweduntilthecursorisclosed.D.LocksobtainedbythecursorwillbekeptafteraCOMMIT.滿分:4分得分:414.GiventhetablecalledNAMEwiththefollowingcolumnanddata:lname-SmithSMITHSmiThsmithWhichofthefollowingSQLstatementswillreturnallfourrowsinuppercase?A.SELECTCAPS(lname)FROMnameB.SELECTUCASE(lnam

19、e)FROMnameC.SELECTSTRUPR(lname)FROMnameD.SELECTTOUPPER(lname)FROMname滿分:4分得分:415.GiventhetablesT1andT2,eachwithanINTEGERcolumn:T1COL1-1-1-22T2COL1-1-2-22andthefollowingquerythatexecutessuccessfully:SELECT*FROMT1LEFTOUTERJOINT2ONT1.COL1=T2.COL1Howmanyrowswillthequeryreturn?A.5B.6C.10D.36滿分:4分得分:416.W

20、hichofthefollowingwillretrieveresultsthatwillonlybeinlowercase?A.SELECTNAMEFROMEMPLOYEEWHERENAME=aliB.SELECTNAMEFROMEMPLOYEEWHERELCASE(NAME)=aliC.SELECTUCASE(NAME)FROMEMPLOYEEWHERELCASE(NAME)=aliD.SELECTNAMEFROMEMPLOYEEWHERENAMEIN(SELECTNAMEFROMEMPLOYEEWHERELCASE(NAME)=LCASE(ALI)滿分:4分得分:417.Giventhe

21、tables:COUNTRYidname1Argentina3Cuba4-NATIONidname2Belgium4USAandthecode:EXECSQLDECLAREC1CURSORFORSELECT*FROMcountryWHEREnameISNOTNULLUNIONSELECT*FROMnationEXECSQLOPENC1Howmanyrowsareintheresultset?A.1B.2C.3D.4滿分:4分得分:418.Giventhetables:EMPLOYEEDEPTemp_numemp_namedeptdept_iddept_name1Adams11Planning2

22、Jones12Support3Smith24Williams1andthestatement:ALTERTABLEemployeeADDFOREIGNKEY(dept)REFERENCESdept(dept_id)ONDELETECASCADEHowmanyrowswillbedeletedwhenthefollowingstatementisexecuted?DELETEFROMemployeeWHEREdept=1A.0B.1C.3D.4滿分:4分得分:419.Whichofthefollowingisabenefitofuser-definedfunctions?A.Improvesap

23、plicationconcurrencyB.ImprovesblockingofresultsetsC.SimplifiesapplicationmaintenanceD.Reducesmemoryrequirementsontheserver滿分:4分得分:420.AnapplicationusesstaticSQLtoconnecttoaremoteDB2serverandinsertsdataintotheCUST.ORDERStableonthatremoteDB2server.ToenableaccesstotheremoteDB2server,FOOneedstocreateapa

24、ckagewithdefaultoptionssothatBARistheonlynon-administrativeuserthatcanusethispackageontheremoteDB2server.WhichstatementdescribestheprivilegesthatFOOrequirestoaccomplishthis?A.FOOrequiresEXECUTEprivilegeonthepackage.B.FOOrequirestheprivilegetocreatethepackageontheremoteDB2server.C.FOOrequiresEXECUTEp

25、rivilegeonthepackageandINSERTprivilegeonCUST.ORDERS.D.FOOrequirestheprivilegetocreatethepackageontheremoteDB2serverandINSERTprivilegeonCUST.ORDERS.滿分:4分得分:421.Ifastoredprocedurereturnsmultiplerows,whichofthefollowingmustthecallingapplicationusetoaccesstheresultset?A.AcursorB.AselectstatementC.AdeclaredtemporarytableD.Atableuser-definedfunction滿分:4分得分:422.WhichofthefollowingCLI/ODBCfunctionsshouldbeusedtodeleterowsfromaDB2table?A.SQLDelete()B.S

溫馨提示

  • 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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論