




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、吉大數(shù)據(jù)庫應(yīng)用技術(shù)在線作業(yè)一答案試卷總分:100 測試時間:- 試卷得分:100單選題一、單選題(共25 道試題,共100 分。得分:100V1. Given the following table:TestTable C1 - 12345 And if the following CLI calls are made:SQLAlloc Handle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&henv; SQLSetEnvAttr( henv,SQL_A TTR_ODBC_VERSION, (SQLPOINTER SQL_OV_ODBC3,0; SQLAllocH
2、andle(SQL_HANDLE_DBC,henv,&hdbc; SQLConnect( hdbc, (SQLCHAR *"db",SQL_NTS, (SQLCHAR *"userid", SQL_NTS, (SQLCHAR *"password", SQL_NTS ;SQLSetConnectAttr( hdbc, SQL_A TTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0;SQLAlloc Handle(SQL_HANDLE_STMT,hdbc,&hstmt; SQLPrepare(hs
3、tmt,(unsignedchar*"select *from Test order by C1',SQL_NTS;SQLBindCol(hstmt,1,SQL_C_SHORT,&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_CO
4、MMIT; SQLFetch(hstmt;printf(Data:%in",data; Which of the following will be returned by theprogram?A. Data: 1 Data: 2 Data: 3 Data: 3B. Data: 1 Data: 2 Data: 3 Data: 4C. Data: 1 Data: 2 Data: 3 Data: 1D. Data: 1 Data: 2 Data: 3 Data: 5滿分:4 分得分:42. Given the code: EXEC SQL DECLARE cursor1 CURSOR
5、FOR SELECTname,age,b_date FROM person; EXEC SQL OPEN cursor1; Under which of thefollowing situations will the above cursor be implicitly closed?A. When a CLOSE statement is issuedB. When a COMMIT statement is issuedC. When there are no rows in the result setD. When all rows are FETCHed from the resu
6、lt set滿分:4 分得分:43. Given the application code: EXEC SQL DECLARE cur CURSOR WITH HOLD FORSELECT c1 FROM t1 EXEC SQL OPEN cur EXEC SQL FETCH cur INTO :hv /*Statement 1 */ EXEC SQL COMMIT /* Statement 2 */ EXEC SQL FETCH cur INTO:hv /* Statement 3 */ EXEC SQL ROLLBACK /* Statement 4 */ EXEC SQL CLOSEcu
7、r /* Statement 5 */ If the table T1 has no rows in it, which statementwill cause the cursor "cur" to be closed first?A. Statement 1B. Statement 2C. Statement 3D. Statement 4滿分:4 分得分:44. How many rows can be retrieved using a single SELECT INTO statement?A. Only one rowB. As many as are in
8、the resultC. As many as are host variables used in the callD. As many as host variable array structures can hold滿分:4 分得分:45. Given the table T1 with the following data: COL1 IDX - - Asingle-threaded CLI application executes the following pseudocode insequence: SQLAllocHandle( SQL_HANDLE_ENV, NULL, &
9、amp;hEnv SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hDbc SQLConnect( hDbc, "SAMPLE", SQL_NTS, NULL,SQL_NTS, NULL, SQL_NTS SQLSetConnectAttr( hDbc, SQL_A TTR_AUTOCOMMIT,SQL_AUTOCOMMIT_ON SQLAllocHandle( SQL_HANDLE_STMT, hDbc, &hStmt SQLExecDirect( hStmt, "UPDA TE table1 SET col1=10
10、WHERE idx=1", SQL_NTS SQLExecDirect( hStmt, "UPDA TE table1 SET col1=20 WHERE idx=2", SQL_NTS SQLEndTran( SQL_HANDLE_DBC, hDbc, SQL_COMMIT SQLExecDirect( hStmt,"UPDA TE table1 SET col1=30 WHERE idx=1", SQL_NTS SQLExecDirect( hStmt,"UPDA TE table1 SET col1=40 WHERE idx=1
11、", SQL_NTS SQLEndTran(SQL_HANDLE_DBC, hDbc, SQL_ROLLBACK SQLExecDirect( hStmt, "SELECT col1FROM table1 WHERE idx=1", SQL_NTS Which of the following values for COL1will be fetched when the sequence for the pseudocode listed above issuccessfully executed?A. 10B. 20C. 30D. 40滿分:4 分得分:46.
12、 Given the table T1 with the following data: C1 C2 - - 1 1 2 2 Anapplication issues the following SQL statements with AUTOCOMMIT disabled:UPDA TE t1 SET c1 = 10 WHERE c2 = 1 UPDA TE t1 SET c1 = 20 WHERE c2 = 2SA VEPOINT sp1 UPDA TE t1 SET c1 = 30 WHERE c2 = 1 UPDA TE t1 SET c1 = 40, c2 = 3 WHERE c2
13、= 2 SA VEPOINT sp1 UPDA TE t1 SET c1 = 50 WHERE c2 = 1 UPDA TE t1 SET c1 = 60 WHERE c2 = 2 ROLLBACK TO SA VEPOINT sp1 UPDA TE t1 SET c1 =50 WHERE c2 = 3 COMMIT What is the result of the following query? SELECTc1, c2 FROM t1 ORDER BY c2A. 10 1 20 2B. 30 1 50 3C. 30 1 40 3D. 10 1 50 3滿分:4 分得分:47. Whic
14、h of the following cursor definitions will define a cursor calledc2 that will fetch rows from table t2, and for every row fetched willupdate column c1 in table t2?A. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDA TE OF t2B. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDA TE OF c2C. DECLARE c2 CURSO
15、R FOR SELECT * FROM t2 FOR UPDA TE OF c1D. DECLARE c2 CURSOR WITH HOLD FOR SELECT * FROM t2 FOR UPDA TE OF t2滿分:4 分得分:48. Given an ODBC/CLI program with a single connection, two threads andthe following actions which complete successfully: Thread 1: INSERT INTOmytab V ALUES (1 Thread 2: INSERT INTO
16、mytab V ALUES (2 Thread 1: COMMITThread 2: INSERT INTO mytab V ALUES (3 Thread 1: ROLLBACK Thread 2: COMMIT How many records will be inserted and retained in the table MYTAB?A. 0B. 1C. 2D. 3滿分:4 分得分:49. Given the following code: EXEC SQL EXECUTE IMMEDIA TE :sqlstmt Which ofthe following values must
17、sqlstmt contain so that all rows are deletedfrom the STAFF table?A. DROP TABLE staffB. DELETE FROM staffC. DROP * FROM staffD. DELETE * FROM staff滿分:4 分得分:410. Given the expression: WITH most_cities AS ( SELECTb.id,,a.cities FROM country a, staff b WHERE a.person = b.id ANDcities > :thresho
18、ld SELECT * FROM most_cities In which of the followingdoes MOST_CITIES exist?A. user tablesB. server memoryC. user table spaceD. system catalog tables滿分:4 分得分:411. Given the following statements: EXEC SQL INSERT INTO employeeV ALUES(:new_emp, :new_name EXEC SQL UPDA TE company SETnum_employees=num_e
19、mployees+1 WHERE company_id=1 EXEC SQL COMMIT Which ofthe following can be added to the database so that the company table willstill be updated without the need for the explic it UPDA TE SQL statement?A. An INSERT trigger on COMPANYB. An UPDA TE trigger on COMPANYC. An INSERT trigger on EMPLOYEED. A
20、n UPDA TE trigger on EMPLOYEE滿分:4 分得分:412. Which of the following produces a sequentially increasing number,suitable for use as a primary key?A. ROWID data typeB. Generated IDENTITY columnC. GENERA TE_UNIQUE built-in functionD. CURRENT SEQUENCE special register滿分:4 分得分:413. A cursor is declared with
21、 the WITH HOLD option. Which of thefollowing statements is always true?A. The cursor will remain open after a COMMIT.B. All rows retrieved are locked until a COMMIT.C. A COMMIT will not be allowed until the cursor is closed.D. Locks obtained by the cursor will be kept after a COMMIT.滿分:4 分得分:414. Gi
22、ven the table called NAME with the following column and data: lname- Smith SMITH SmiTh smith Which of the following SQL statements willreturn all four rows in upper case?A. SELECT CAPS(lname FROM nameB. SELECT UCASE(lname FROM nameC. SELECT STRUPR(lname FROM nameD. SELECT TOUPPER(lname FROM name滿分:4
23、 分得分:415. Given the tables T1 and T2, each with an INTEGER column: T1 COL1- 1- 1- 22 T2 COL1 - 1- 2- 22 and the following querythat executes successfully: SELECT * FROM T1 LEFT OUTER JOIN T2 ONT1.COL1=T2.COL1 How many rows will the query return?A. 5B. 6C. 10D. 36滿分:4 分得分:416. Which of the following
24、will retrieve results that will only be inlower case?A. SELECT NAME FROM EMPLOYEE WHERE NAME='ali'B. SELECT NAME FROM EMPLOYEE WHERE LCASE(NAME='ali'C. SELECT UCASE(NAME FROM EMPLOYEE WHERE LCASE(NAME='ali'D. SELECT NAME FROM EMPLOYEE WHERE NAME IN (SELECT NAME FROM EMPLOYEEW
25、HERE LCASE(NAME=LCASE('ALI'滿分:4 分得分:417. Given the tables: COUNTRY id name 1 Argentina 3 Cuba 4 - NA TION idname 2 Belgium 4 USA and the code: EXEC SQL DECLARE C1 CURSOR FOR SELECT *FROM country WHERE name IS NOT NULL UNION SELECT * FROM nation EXEC SQLOPEN C1 How many rows are in the result
26、 set?A. 1B. 2C. 3D. 4滿分:4 分得分:418. Given the tables: EMPLOYEE DEPT emp_num emp_name dept dept_iddept_name 1 Adams 1 1 Planning 2 Jones 1 2 Support 3 Smith 2 4 Williams 1and the statement: ALTER TABLE employee ADD FOREIGN KEY (dept REFERENCES dept (dept_id ON DELETE CASCADE How many rows will be dele
27、ted when thefollowing statement is executed? DELETE FROM employee WHERE dept=1A. 0B. 1C. 3D. 4滿分:4 分得分:419. Which of the following is a benefit of user-defined functions?A. Improves application concurrencyB. Improves blocking of result setsC. Simplifies application maintenanceD. Reduces memory requi
28、rements on the server滿分:4 分得分:420. An application uses static SQL to connect to a remote DB2 server andinserts data into the CUST.ORDERS table on that remote DB2 server. Toenable access to the remote DB2 server, FOO needs to create a package withdefault options so that BAR is the only non-administra
29、tive user that canuse this package on the remote DB2 server. Which statement describes theprivileges that FOO requires to accomplish this?A. FOO requires EXECUTE privilege on the package.B. FOO requires the privilege to create the package on the remote DB2server.C. FOO requires EXECUTE privilege on
30、the package and INSERT privilege onCUST.ORDERS.D. FOO requires the privilege to create the package on the remote DB2server and INSERT privilege on CUST.ORDERS.滿分:4 分得分:421. If a stored procedure returns multiple rows, which of the followingmust the calling application use to access the result set?A. A cursor B. A select statement C. A declared temporary table D. A table user-defined function 滿分:4 分 得分:4 22. Which of the following CLI/ODBC functions should be used to delete rows from a
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 快速掌握商業(yè)分析師試題及答案
- 自我提升的統(tǒng)計學試題及答案2024
- 2024汽車維修工職業(yè)素養(yǎng)考核試題及答案
- 市場營銷中的戰(zhàn)略思考小自考試題及答案
- 藥物的機體反應(yīng)試題與答案
- 省考食品質(zhì)檢員的職業(yè)素養(yǎng)提升試題及答案
- 統(tǒng)計學重點難點解析及試題答案
- 2024-2025學年內(nèi)蒙古巴彥淖爾一中高一下學期第一次學業(yè)診斷物理及答案
- 春姑娘打電話課件
- 汽車美容技巧提升的考試試題及答案
- 2025年4月自考15040習概押題及答案
- 園林花卉 課件 第三篇1單元 一二年生花卉
- 【初中生物】植物在自然界中的作用 2024-2025學年七年級生物下學期課件(人教版2024)
- 2024年安慶市迎江區(qū)招聘社區(qū)人員考試真題
- 燃氣工程AI智能應(yīng)用企業(yè)制定與實施新質(zhì)生產(chǎn)力戰(zhàn)略研究報告
- 《休閑農(nóng)業(yè)》課件 項目五 休閑農(nóng)業(yè)項目規(guī)劃設(shè)計
- 工藝美術(shù)品設(shè)計師(漆器設(shè)計與制作)賽項實施方案
- 廣東省2025屆高三下學期3月綜合能力測試(CAT) 英語試題(含答案)
- 期中評估檢測題無答案2024-2025學年七年級下冊道德與法治
- 2025年江蘇省職業(yè)院校技能大賽中職組(網(wǎng)絡(luò)建設(shè)與運維)考試題(附答案)
- 統(tǒng)編版(2024)七年級下冊《道德與法治》課本“活動課”參考答案
評論
0/150
提交評論