资源描述:
《吉大数据库应用技术在线作业一答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、吉大《数据库应用技术》在线作业一答案试卷总分:100测试时间:--试卷得分:100单选题一、单选题(共25道试题,共100分。)得分:100V1.Giventhefollowingtable:TestTableC1-----------12345AndifthefollowingCLIcallsaremade:SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&henv);SQLSetEnvAttr(henv,SQL_ATTR_ODBC_VERSION,(SQLPOINTER)SQL_O
2、V_ODBC3,0);SQLAllocHandle(SQL_HANDLE_DBC,henv,&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);SQLPrepar
3、e(hstmt,(unsignedchar*)"select*fromTestorderbyC1',SQL_NTS);SQLBindCol(hstmt,1,SQL_C_SHORT,&data,0,NULL);SQLExecute(hstmt);SQLFetch(hstmt);printf(Data:%i",data);SQLFetch(hstmt);printf(Data:%i",data);SQLFetch(hstmt);printf(Data:%i",data);SQLEndTran(SQL_HANDLE_ENV
4、,henv,SQL_COMMIT);SQLFetch(hstmt);printf(Data:%i",data);Whichofthefollowingwillbereturnedbytheprogram?A.Data:1Data:2Data:3Data:3B.Data:1Data:2Data:3Data:4C.Data:1Data:2Data:3Data:1D.Data:1Data:2Data:3Data:5满分:4分得分:42.Giventhecode:EXECSQLDECLAREcursor1CURSORFORSELEC
5、Tname,age,b_dateFROMperson;EXECSQLOPENcursor1;Underwhichofthefollowingsituationswilltheabovecursorbeimplicitlyclosed?A.WhenaCLOSEstatementisissuedB.WhenaCOMMITstatementisissuedC.WhentherearenorowsintheresultsetD.WhenallrowsareFETCHedfromtheresultset满分:4分得分:43.Giventh
6、eapplicationcode:EXECSQLDECLAREcurCURSORWITHHOLDFORSELECTc1FROMt1EXECSQLOPENcurEXECSQLFETCHcurINTO:hv/*Statement1*/EXECSQLCOMMIT/*Statement2*/EXECSQLFETCHcurINTO:hv/*Statement3*/EXECSQLROLLBACK/*Statement4*/EXECSQLCLOSEcur/*Statement5*/IfthetableT1hasnorowsinit,which
7、statementwillcausethecursor"cur"tobeclosedfirst?A.Statement1B.Statement2C.Statement3D.Statement4满分:4分得分:44.HowmanyrowscanberetrievedusingasingleSELECTINTOstatement?A.OnlyonerowB.AsmanyasareintheresultC.AsmanyasarehostvariablesusedinthecallD.Asmanyashostvariablearrays
8、tructurescanhold满分:4分得分:45.GiventhetableT1withthefollowingdata:COL1IDX--------Asingle-threadedCLIapplicationexecutesthefollowingpse