奥鹏作业答案-谋学网-专业的奥鹏在线作业答案辅导网【官网】

 找回密码
 会员注册

微信登录,扫一扫

手机号码,快捷登录

VIP会员,3年作业免费下 !奥鹏作业,奥鹏毕业论文检测新手作业下载教程,充值问题没有找到答案,请在此处留言!
2022年5月最新全国统考资料投诉建议,加盟合作!点击这里给我发消息 点击这里给我发消息
奥鹏课程积分软件(2021年最新)
查看: 1301|回复: 0

13春吉大《数据库应用技术》在线作业一二

[复制链接]
发表于 2013-4-26 10:35:46 | 显示全部楼层 |阅读模式
谋学网
一、单选(共 25 道试题,共 100 分。)V 1.  Given the following table: TestTable C1 ----------- 12345 And if the following CLI calls are made: SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&henv); SQLSetEnvAttr( henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3,0); SQL AllocHandle(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); SQLPrepare(hstmt,(unsigned char*)"select *from Test order by C1',SQL_NTS); SQLBindCol(hstmt,1,SQL_C_SHORT,&data,0,NULL); SQLExecute(hstmt); SQLFetch(hstmt); printf(Data:%i\n",data); SQLFetch(hstmt); printf(Data:%i\n",data); SQLFetch(hstmt); printf(Data:%i\n",data); SQLEndTran(SQL_HANDLE_ENV,henv,SQL_COMMIT); SQLFetch(hstmt); printf(Data:%i\n",data); Which of the following will be returned by the program?
0 y; \9 i$ j  K$ Z7 }. v, X! L) zA. Data: 1 Data: 2 Data: 3 Data: 3/ ]  s0 ?4 s4 B* }+ Z
B. Data: 1 Data: 2 Data: 3 Data: 4( L; e" ]0 L% U
C. Data: 1 Data: 2 Data: 3 Data: 1
2 z3 X2 x+ t, ?. V+ U* Z* j2 gD. Data: 1 Data: 2 Data: 3 Data: 5
3 A8 v; p( {& p& `. p3 E: x      满分:4  分3 V4 R/ f6 x/ R3 s& i8 s
2.  Given the code: EXEC SQL DECLARE cursor1 CURSOR FOR SELECT name,age,b_date FROM person; EXEC SQL OPEN cursor1; Under which of the following situations will the above cursor be implicitly closed?
; o. R* }+ Q/ D. |$ hA. When a CLOSE statement is issued
6 a8 P$ ]+ K7 `2 c2 dB. When a COMMIT statement is issued
$ S5 H) I, s3 d7 Y7 Q/ G' K7 KC. When there are no rows in the result set. z9 @/ `5 W7 K5 Q2 p6 T% V
D. When all rows are FETCHed from the result set2 {3 W* X4 A# ^" ]0 X  l
      满分:4  分& l, h1 B8 H' }' E! [# Z
3.  Given the application code: EXEC SQL DECLARE cur CURSOR WITH HOLD FOR SELECT 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 CLOSE cur /* Statement 5 */ If the table T1 has no rows in it, which statement will cause the cursor "cur" to be closed first?
" a0 q% A7 M% j: e* iA. Statement 1
' U4 `& t! ~0 Q6 e; F4 e* _% rB. Statement 27 b/ U) X% M* q6 I4 l1 V7 o/ [
C. Statement 3
  j, Q0 ^' W/ c$ t5 ID. Statement 4) b! M+ m! ]$ A. o2 ^, G
      满分:4  分
. v. h! e5 o7 v- V4.  How many rows can be retrieved using a single SELECT INTO statement?  W# h/ J+ e& q) T# m# D5 Z( _, V
A. Only one row: ]9 H; u' V, m7 g1 G7 v( n) Z
B. As many as are in the result2 X4 G0 v4 M8 K5 t1 @
C. As many as are host variables used in the call
6 A& t' c* X1 ]& C; h% P& `5 RD. As many as host variable array structures can hold8 L: b- |. O% [
      满分:4  分
7 |% _& ?- C! ~7 I( [2 r5.  Given the table T1 with the following data: COL1 IDX ---- ---- A single-threaded CLI application executes the following pseudocode in sequence: SQLAllocHandle( SQL_HANDLE_ENV, NULL, &hEnv ) SQLAllocHandle( SQL_HANDLE_DBC, hEnv, &hDbc ) SQLConnect( hDbc, "SAMPLE", SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS ) SQLSetConnectAttr( hDbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_ON ) SQLAllocHandle( SQL_HANDLE_STMT, hDbc, &hStmt ) SQLExecDirect( hStmt, "UPDATE table1 SET col1=10 WHERE idx=1", SQL_NTS ) SQLExecDirect( hStmt, "UPDATE table1 SET col1=20 WHERE idx=2", SQL_NTS ) SQLEndTran( SQL_HANDLE_DBC, hDbc, SQL_COMMIT ) SQLExecDirect( hStmt, "UPDATE table1 SET col1=30 WHERE idx=1", SQL_NTS ) SQLExecDirect( hStmt, "UPDATE table1 SET col1=40 WHERE idx=1", SQL_NTS ) SQLEndTran( SQL_HANDLE_DBC, hDbc, SQL_ROLLBACK ) SQLExecDirect( hStmt, "SELECT col1 FROM table1 WHERE idx=1", SQL_NTS ) Which of the following values for COL1 will be fetched when the sequence for the pseudocode listed above is successfully executed?4 ?- O/ t, W* t& T4 D. }1 F
A. 10
, G$ d, v2 [/ `) z( z' R8 p2 QB. 20: `  D; @% u  T1 k
C. 30
2 A! c/ d. g- [- a! [9 f; ^1 \D. 40
' ]/ m: b3 G% X& t, Y3 p      满分:4  分# S. C" e1 V; q) Q# A
6.  Given the table T1 with the following data: C1 C2 -- -- 1 1 2 2 An application issues the following SQL statements with AUTOCOMMIT disabled: UPDATE t1 SET c1 = 10 WHERE c2 = 1 UPDATE t1 SET c1 = 20 WHERE c2 = 2 SAVEPOINT sp1 UPDATE t1 SET c1 = 30 WHERE c2 = 1 UPDATE t1 SET c1 = 40, c2 = 3 WHERE c2 = 2 SAVEPOINT sp1 UPDATE t1 SET c1 = 50 WHERE c2 = 1 UPDATE t1 SET c1 = 60 WHERE c2 = 2 ROLLBACK TO SAVEPOINT sp1 UPDATE t1 SET c1 = 50 WHERE c2 = 3 COMMIT What is the result of the following query? SELECT c1, c2 FROM t1 ORDER BY c23 c- n9 J; }% c  V' r
A. 10 1 20 2
$ k- N: b6 \, O; CB. 30 1 50 3+ V$ ?6 N2 K% N9 i1 U$ t1 G1 A
C. 30 1 40 3( X" ]; v# {% P* [5 t0 C
D. 10 1 50 31 @/ P( ?9 c! K' W  h( h! r
      满分:4  分2 ?+ v# c: }, ~
7.  Which of the following cursor definitions will define a cursor called c2 that will fetch rows from table t2, and for every row fetched will update column c1 in table t2?
7 J1 U: c4 p& c8 l( q+ t9 _* `A. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDATE OF t2
$ }+ b* z/ w6 kB. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDATE OF c2( x# U/ y! O7 X0 k3 S6 w
C. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDATE OF c1
8 R  o& c$ ~  ^# c4 JD. DECLARE c2 CURSOR WITH HOLD FOR SELECT * FROM t2 FOR UPDATE OF t2) B1 W& _: {  P# D' [, y
      满分:4  分: R- P- f6 Q" \: B
8.  Given an ODBC/CLI program with a single connection, two threads and the following actions which complete successfully: Thread 1: INSERT INTO mytab VALUES (1) Thread 2: INSERT INTO mytab VALUES (2) Thread 1: COMMIT Thread 2: INSERT INTO mytab VALUES (3) Thread 1: ROLLBACK Thread 2: COMMIT How many records will be inserted and retained in the table MYTAB?
  v" Q: s1 `' S0 j3 _/ fA. 0
& H4 T" o" t2 O( IB. 1
  X( G( z0 ]- ]" [/ q9 @C. 2
4 S/ k# `  k4 V/ F- gD. 39 c2 J6 K& K. o$ p" P8 v
      满分:4  分) k! y& m! K7 ~% {5 _
9.  Given the following code: EXEC SQL EXECUTE IMMEDIATE :sqlstmt Which of the following values must sqlstmt contain so that all rows are deleted from the STAFF table?. [* C: ]2 y$ ~, ]  t, m
A. DROP TABLE staff+ \( d1 Z: K; H) p) A, _
B. DELETE FROM staff$ W/ m9 R3 n% ^& {$ _
C. DROP * FROM staff# v' [  Z1 D4 Y# r: D
D. DELETE * FROM staff
9 G- I: E4 x' g      满分:4  分
# a& M) A2 Y" n  n4 W! w: a! R10.  Given the expression: WITH most_cities AS ( SELECT b.id,b.name,a.cities FROM country a, staff b WHERE a.person = b.id AND cities > :threshold ) SELECT * FROM most_cities In which of the following does MOST_CITIES exist?% V1 `+ H# r: [1 P2 `; a
A. user tables" Y+ P: S: B9 V8 P# v
B. server memory; B" V  t# c9 K0 P
C. user table space& @9 z; E$ a" t9 u
D. system catalog tables5 f6 a4 s. I3 _$ V2 G/ y; }$ n# w# O
      满分:4  分
- ~. t! e: c1 i- K11.  Given the following statements: EXEC SQL INSERT INTO employee VALUES(:new_emp, :new_name) EXEC SQL UPDATE company SET num_employees=num_employees+1 WHERE company_id=1 EXEC SQL COMMIT Which of the following can be added to the database so that the company table will still be updated without the need for the explicit UPDATE SQL statement?
# W$ t* W0 K( b8 qA. An INSERT trigger on COMPANY
1 s6 h5 V3 G  p( `" B5 C3 o2 [B. An UPDATE trigger on COMPANY
9 L: A( Y$ U3 PC. An INSERT trigger on EMPLOYEE
  {6 A. P' l# ^D. An UPDATE trigger on EMPLOYEE7 B4 d  Q, Y) D; S7 z7 U
      满分:4  分  n0 n9 g2 E/ e1 r, m$ z$ h
12.  Which of the following produces a sequentially increasing number, suitable for use as a primary key?
6 h% y- I  D. X5 m! m0 X+ W+ bA. ROWID data type
# w3 c7 J! ?' _7 U  C% xB. Generated IDENTITY column
9 t$ I& `$ x( U+ kC. GENERATE_UNIQUE built-in function6 L$ ~. D0 }" s6 Y" \3 v6 j- q" t
D. CURRENT SEQUENCE special register( e6 D) ^' y* C
      满分:4  分3 a" Z' b+ C8 F& p( K; }
13.  A cursor is declared with the WITH HOLD option. Which of the following statements is always true?
; E* _' c* v9 yA. The cursor will remain open after a COMMIT./ x, g% A% G8 d0 b7 O% r
B. All rows retrieved are locked until a COMMIT.
+ W9 c# I4 u. w! k* cC. A COMMIT will not be allowed until the cursor is closed.
3 P' V' o% t& W4 SD. Locks obtained by the cursor will be kept after a COMMIT.
- x9 |, t5 w7 i; w( P      满分:4  分0 B& ^, o, \+ L
14.  Given the table called NAME with the following column and data: lname ------ Smith SMITH SmiTh smith Which of the following SQL statements will return all four rows in upper case?
& u8 d9 {- D6 t- M5 kA. SELECT CAPS(lname) FROM name3 k8 ~0 I6 p+ ?/ ~4 K
B. SELECT UCASE(lname) FROM name
8 P1 [  J. }* H( N8 A' pC. SELECT STRUPR(lname) FROM name
! {5 z" X8 U* u4 W6 l/ qD. SELECT TOUPPER(lname) FROM name
, H  x+ l  O! `0 X) _0 b      满分:4  分8 S6 J2 m% P! ^7 g2 J! v
15.  Given the tables T1 and T2, each with an INTEGER column: T1 COL1 ----------- 1- 1- 22 T2 COL1 ----------- 1- 2- 22 and the following query that executes successfully: SELECT * FROM T1 LEFT OUTER JOIN T2 ON T1.COL1=T2.COL1 How many rows will the query return?1 E6 A8 f  l7 n( x$ F) P; ]
A. 5! _$ D5 e% w& @: B% [  [% W6 I
B. 6* F$ }/ K: k- C7 O9 Q& U
C. 10+ W+ q% ?& m4 C3 {0 R: Q
D. 36
0 ^5 C7 y* [) A' {  F5 c+ j4 D' t      满分:4  分$ F+ E7 M) D& P: S2 f
16.  Which of the following will retrieve results that will only be in lower case?. a  X6 g1 z# {
A. SELECT NAME FROM EMPLOYEE WHERE NAME='ali'
2 \. @$ d: [4 W  S* u9 JB. SELECT NAME FROM EMPLOYEE WHERE LCASE(NAME)='ali'1 O2 ^9 e/ G+ o( H5 I6 y, s- x* P
C. SELECT UCASE(NAME) FROM EMPLOYEE WHERE LCASE(NAME)='ali'
+ j* @! M" C- u6 ND. SELECT NAME FROM EMPLOYEE WHERE NAME IN (SELECT NAME FROM EMPLOYEE WHERE LCASE(NAME)=LCASE('ALI'))
% e" [0 R/ \2 o* e  I% l0 J      满分:4  分
- E" Q* p. V" O" Y0 L8 t& {17.  Given the tables: COUNTRY id name 1 Argentina 3 Cuba 4 - NATION id name 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 SQL OPEN C1 How many rows are in the result set?' f' v* ?; c! f% C
A. 1# F1 _# [1 `# {& `8 b( r
B. 24 ^7 a7 ]6 X" @* n9 R
C. 3
* P; d7 Q" i7 s0 d) e3 d* PD. 4
, r  j5 i8 ?7 r$ W' Q      满分:4  分
8 N8 z& b0 f9 J4 M1 B18.  Given the tables: EMPLOYEE DEPT emp_num emp_name dept dept_id dept_name 1 Adams 1 1 Planning 2 Jones 1 2 Support 3 Smith 2 4 Williams 1 and the statement: ALTER TABLE employee ADD FOREIGN KEY (dept) REFERENCES dept (dept_id) ON DELETE CASCADE How many rows will be deleted when the following statement is executed? DELETE FROM employee WHERE dept=12 ^+ F& R# V, k* `
A. 0
- Z; f/ u) _5 M( w6 L# f* sB. 1
. d  Z8 ^$ J8 t; y$ K) oC. 3
) |+ P8 V' o. O1 ?! N' H* G6 qD. 4# l. ^6 W; N  V. v$ ~" w* [
      满分:4  分& C1 f' p. G0 t; Z- a# n7 N
19.  Which of the following is a benefit of user-defined functions?3 W" A+ y& |3 q( F, O; p! n
A. Improves application concurrency
8 o1 z$ C3 o, u% K7 MB. Improves blocking of result sets
! ?0 s' B1 Q: L- s( ]9 NC. Simplifies application maintenance
' ^+ N2 ]; P0 e0 P! PD. Reduces memory requirements on the server6 B% l' ?& {' Z' x- g5 G" L
      满分:4  分& z, t' _2 `2 P: J% P
20.  An application uses static SQL to connect to a remote DB2 server and inserts data into the CUST.ORDERS table on that remote DB2 server. To enable access to the remote DB2 server, FOO needs to create a package with default options so that BAR is the only non-administrative user that can use this package on the remote DB2 server. Which statement describes the privileges that FOO requires to accomplish this?5 C! v& Z6 c' U& R" @
A. FOO requires EXECUTE privilege on the package.
4 |  O- ]" p8 R, YB. FOO requires the privilege to create the package on the remote DB2 server.( h9 }& W8 c/ B( T  H2 s$ s
C. FOO requires EXECUTE privilege on the package and INSERT privilege on CUST.ORDERS.
& j3 X, U& S8 {0 ~: l' {3 wD. FOO requires the privilege to create the package on the remote DB2 server and INSERT privilege on CUST.ORDERS.( a4 y% ?! d6 A* b6 {
      满分:4  分; g" ~; K5 y2 v: f
21.  If a stored procedure returns multiple rows, which of the following must the calling application use to access the result set?! G3 o3 g. k2 @& `0 O
A. A cursor
% e- c$ \7 c$ P9 P, G; @B. A select statement4 y+ Y6 x% o0 o) [
C. A declared temporary table
' ^1 F% v3 z% L! ?! [4 j5 FD. A table user-defined function. F" L. T( B% \/ G! Y" b$ Q' _5 @4 s
      满分:4  分
/ z& |/ \( M% j* [8 L/ e; S8 Q% [22.  Which of the following CLI/ODBC functions should be used to delete rows from a DB2 table?: W' `( f) q( P+ {) e+ X1 D6 x& f/ j" Y
A. SQLDelete()
# \5 u8 c- ?5 D& l3 c: ^B. SQLExecDirect()
& K) f1 L3 ~/ a/ h/ T$ I; R7 oC. SQLBulkDelete(), P' ]1 O4 m- R: |2 K4 y
D. SQLExecuteUpdate()2 K9 R4 V) C0 ]: i% K. ]3 e+ [
      满分:4  分" s* O! \1 B9 x
23.  Which of the following is used to run an embedded dynamic SQL UPDATE statement?
! R& Z& P6 ]7 S( d8 k9 c4 QA. UPDATE
% \; x3 b, J; @, y& L; i, L$ fB. . PREPARE- d7 P1 H( i* ~0 F5 b( j. M
C. . DECLARE+ a; y5 {+ u5 h- N* l; l7 _5 h
D. . EXECUTE
+ O1 M4 u$ K' H      满分:4  分
( ^: Y1 l& G* C, ?! b! j5 g24.  An ODBC/CLI application performs an array insert into a table containing a primary key. If one of the values inserted generates a duplicate row error, which of the following APIs can be called to determine the failing row?
! J, u- m( p' a* N4 ]A. SQLError()
( s) N& P; Y7 H8 cB. SQLNumRows()% K# H% D$ U" `- M' {
C. SQLRowCount()& U! L# b' r" O) c# B+ S
D. SQLGetDiagField()8 T; N7 S0 n9 N' ^% q8 k
      满分:4  分2 F+ _+ J5 y8 C9 A2 F/ f. a5 e# Y
25.  Given the following code: BEGIN ATOMIC UPDATE country SET cities=:count WHERE CURRENT OF C1; INSERT INTO country VALUES(:co11,:co12,:co13); INSERT INTO country VALUES(:co14,:co15,:co16); INSERT INTO country VALUES(:co17,:co18,:co19); INSERT INTO country VALUES(:co110,:co111,:co112); COMMIT; END Given that all statements succeed except the following: INSERT INTO country VALUES(:co17,:co18,:co19); How many rows will be affected in table COUNTRY?
4 b# ~9 A; T. F$ T1 PA. 07 c% W# c# z3 n
B. 3* K% `+ r# e( a& E
C. 4
6 i. M7 [* v1 @- M! S5 RD. 5
/ \2 z1 m/ ]( v3 d% L4 f$ }5 ?      满分:4  分
: P. b/ _8 d% N! Z0 S& U4 y: Y& w( x) C7 Y9 Y5 S- m/ {

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?会员注册

×
奥鹏作业答案,奥鹏在线作业答案
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

 
 
客服一
客服二
客服三
客服四
点这里给我发消息
点这里给我发消息
谋学网奥鹏同学群2
微信客服扫一扫

QQ|关于我们|联系方式|网站特点|加入VIP|加盟合作|投诉建议|法律申明|Archiver|小黑屋|奥鹏作业答案-谋学网 ( 湘ICP备2021015247号 )

GMT+8, 2025-2-2 06:00 , Processed in 0.109388 second(s), 24 queries .

Powered by Discuz! X3.5

Copyright © 2001-2025 Tencent Cloud.

快速回复 返回顶部 返回列表