|
一、单选题(共 25 道试题,共 100 分。)V 1. Under which of the following situations must dynamic SQL be used?
2 ^/ Q% N# ?2 y' FA. When temporary table references exist at compile time/ A! F- z1 U0 l% f" v+ v5 Y$ P
B. When the host variables' values are unknown at compile time) j" x! }$ t G$ z7 p! [
C. When the columns in the SELECT clause are unknown at compile time
. p( s" x1 C) X; V* fD. When the number of rows being returned are unknown at compile time( i% c+ n& @/ W3 k, _
满分:4 分
1 n- c5 A# p# N/ I2. 使用SQL语句进行查询操作时,若希望查询结果不出现重复元组,应在SELECT子句中使用什么保留字?. _5 j2 N x. ]: i" U0 C. w. |
A. NIQUE
5 `) g; u! h. f2 ?B. ALL
8 S% B3 t+ j9 I& C8 E$ u2 yC. EXCEPT$ C' l {2 L3 r
D. DISTINCT
/ k" L( ~' d1 l2 L( f9 o, ? 满分:4 分
! b1 i. \3 e/ ]% @; h3. 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?$ _ Y) A$ `% I* }* ~ V; h
A. 10' `- T0 G1 C' k$ D4 U1 |
B. 20
$ z8 N8 |, v' j" {C. 30
, _8 y* I5 W M( V( UD. 400 w5 f& d+ w+ _# f6 A' g/ U
满分:4 分: i" Q: I$ O, e8 K: u
4. 下面哪一工具允许用户开发存储过程?
1 x8 Y' o, j% @% w) W3 _! V7 G( qA. 控制中心
3 R$ h1 x0 Z# s j v! rB. 命令中心8 j# Q# ~. z* v V1 v" ]
C. 任务中心
- Y3 ?1 Z; s7 x$ q( eD. 开发中心& n- Q; l! q' _' i
E. 健康中心
9 G$ R5 _1 q5 T' J+ i! [/ f! ] 满分:4 分6 k6 Z) J4 o8 |% N7 u. q
5. 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?) n$ b. V/ g4 C, [$ `5 f% J+ W
A. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDATE OF t2
' | ?! c" o: {$ f2 b; C& ]B. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDATE OF c23 u' Z% [* `' `, F9 T; P0 o
C. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDATE OF c1- g! ]: R4 e6 m0 j
D. DECLARE c2 CURSOR WITH HOLD FOR SELECT * FROM t2 FOR UPDATE OF t2! t p5 F7 u6 ~& O" g
满分:4 分7 j. q/ |) o& d4 i/ ~3 W
6. 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?# X7 @* t& }- x2 ]0 _& u
A. Data: 1 Data: 2 Data: 3 Data: 3
, r, f l) {( f1 i$ G8 S. [6 FB. Data: 1 Data: 2 Data: 3 Data: 4+ ^5 Y9 z! z% ?4 K! v9 l, B
C. Data: 1 Data: 2 Data: 3 Data: 1- X7 t- |, X3 s7 V
D. Data: 1 Data: 2 Data: 3 Data: 5
4 ?: i/ A' P9 W- S 满分:4 分
" c5 D& g- l- \3 y3 W7. 给定三个表:学生表S,课程表C和学生选课表SC,它们的结构分别如下: S(S#,SN,SEX,AGE,DEPT) C(C#,CN) SC(S#,C#,GRADE)其中:S#为学号,SN为姓名,SEX为性别,AGE为年龄,DEPT为系别,C#为课程号,CN为课程名,GRADE为成绩。检索选修课程“C2”的学生中成绩最高的学生的学号,正确的SELECT语句是哪个?
% D( S. j6 j; L% f9 ?) y2 sA. SELECT S# FROM SC WHERE C#=“C2” AND GRADE >= (SELECT GRADE FROM SC WHERE C#=” C2”)
: U% C0 A V5 ^* o/ {; H6 E" JB. SELECT S# FROM SC WHERE C#=”C2” AND GRADE IN (SELECT GRADE FROM SC WHERE C#=”C2”)
4 N5 W8 P! z/ L9 t! ?C. SELECT S# FROM SC WHERE C#=”C2” AND GRADE NOT IN (SELECT GRADE FROM SC WHERE C#=”C2”)* i, V2 E2 N5 I! O) z# I: @! b
D. SELECT S# FROM SC WHERE C#=”C2” AND GRADE>=ALL (SELECT GRADE FROM SC WHERE C#=”C2”)) m0 n/ J! P7 N9 U$ d& N4 M6 g
满分:4 分
* ?; t9 \( l: o* `3 ?8. 如果用户在SQL语句中没有指定数据库对象的SCHEMA,则其缺省的SCHEMA是:5 N" j, Q4 |& m/ {9 Y6 g+ [
A. SYSIBM
' v J' X- N$ W IB. SYSCAT1 r- ?8 D6 w3 Q
C. SYSSTAT
4 D3 a2 U0 q, sD. 该用户连接到数据库时所使用的用户名8 J$ v. B6 R& y; O4 r
E. 以上都不对7 w' h) Z- D- k
满分:4 分
+ _5 {3 q; q) L6 X c9. Which of the following is TRUE for all cursors defined as FOR FETCH ONLY? u& {$ V( Z; n/ ?+ F8 J
A. The cursors are unambiguous.; s7 u4 c: V( o6 \+ M
B. Only the first row is returned.3 V" R v q- U8 b4 \
C. Cursor stays open after a commit.8 R( @$ u( t0 ?+ B5 q- u A
D. A temporary table is created on the server.
: f# X. _- \ h! S# ~$ q 满分:4 分% q: U, A, }& |* E
10. Which of the following is a benefit of user-defined functions?
; `. M& B- R# c( o; [, WA. Improves application concurrency% ^, |7 R- f7 w9 `, O; R6 r- Q# V9 t
B. Improves blocking of result sets7 x5 z2 o# c( ]9 t+ E" ~9 o- f
C. Simplifies application maintenance p; S7 K# K* T3 q( t
D. Reduces memory requirements on the server
; D3 g; w6 o; A 满分:4 分9 a9 r$ X# y# A) _" c
11. 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?
- x/ `2 v' K; A7 ZA. Statement 1
8 Q! S" V9 d9 iB. Statement 2
7 c5 @0 j7 @; fC. Statement 3$ }7 r: K! u0 L; g, U
D. Statement 4
3 m' a. q9 o+ [8 C) b 满分:4 分
2 V8 r; ]) h5 J4 e5 }* @3 v12. 如果需要创建一个表,并把表中的索引数据和其他数据分开存储,则应该
4 L" ^. g. A g# gA. 建立两个SMS表空间分别存储索引数据和其他数据
. b) ~& e6 h ^2 _; n' I% eB. 建立两个DMS表空间分别存储索引数据和其他数据( Z' z R% E( Y& @2 O6 l6 S( x" y
C. 建立一个DMS表空间存储索引数据,再建立一个SMS表空间存储其他数据1 S! X5 {- L g6 n1 d
D. 建立一个SMS表空间存储索引数据,再建立一个DMS表空间存储其他数据8 b% z/ K2 @* _, |1 q# K
满分:4 分
' H8 t- S' Q/ q/ U) ]13. SQL语言具有()功能。, a* Y* x3 l) a# l1 w( X
A. 关系规范化、数据操纵、数据控制
, v7 R) I4 M" Q( n' T( OB. 数据定义、数据操纵、数据控制& J$ k# `# G% h6 ~$ R
C. 数据定义、关系规范化、数据控制
8 ^* G" ]! f* j+ V3 JD. 数据定义、关系规范化、数据操纵
/ f& Y, L5 `- M 满分:4 分/ @+ r v2 J8 ]
14. 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? J2 w( K( t% |5 f
A. 0
, o4 N( B) s( Y( l8 FB. 39 ?9 _) X$ r2 ?1 o p7 }
C. 4% [& e0 T# q/ t/ p9 t
D. 5
( M$ m7 |8 \6 v% y- ? 满分:4 分! ?% A( Y& } s; ]$ W
15. 设有两个事务T1,T2,其并发操作如下所示: T1: T2: 1) 读A=10,B=5 2) 读A=10 3) 读A=20,B=5 求和25 验证错正确的评价是哪个?7 P- S/ s$ K4 C# E" q% @
A. 该操作不存在问题
8 K4 N( c0 c6 p! R7 f# ~2 Q+ @B. 该操作丢失000
* [; b2 ?( p ~ x: AC. 该操作不能重复读
{' z- ~ a! _! G0 b2 X* WD. 该操作读“脏”数据
/ B0 q% W+ Z$ Q$ g1 J% t0 e 满分:4 分
1 o9 a' X! ~7 w; f8 C p5 e16. 若用如下的SQL语句创建一个student表: CREATE TABLE student(NO CHAR(4) NOT NULL, NAME CHAR(8) NOT NULL, SEX CHAR(2), AGE NUMBERIC(2))可以插入到student表中的是哪一项?7 R+ k8 G# h( s; k) q
A. (‘1031’,‘曾华’,男,23)
; t0 \) ?1 }( ? n$ A& BB. (‘1031’,‘曾华’,NULL,NULL)
$ _3 I' u+ }" @ p, AC. (NULL,‘曾华’,‘男’,‘23’)$ S' F; W$ O9 x% Q
D. (‘1031’,NULL,‘男’,23); u; v! I1 n/ `% X3 M: m+ ~
满分:4 分& \5 w2 K7 Q8 U" x: f% y/ G
17. 如果开发人员在AIX操作系统上开发访问后台AS400上的DB2数据库,则需要在AIX开发环境中安装:()
: a2 H0 P6 Y: ?# D+ nA. DB2个人开发版(PDE)
! u, y+ I. y& OB. DB2通用开发版(UDE)
' T. F) B0 i$ q. } 满分:4 分
8 D. a3 C1 ]7 S$ k" z/ f18. 执行下面两条SQL语句后: CREATE TABLE t1 ( c1 char(10) NOT NULL PRIMARY KEY, c2 int, c3 char(10), c4 char(10) NOT NULL, CONSTRAINT c4 UNIQUE (c1,c4) ) //自动创建索引 CREATE INDEX Index1 ON t1 (c2 ASC) 表t1上有几个索引?- T- V* g) s1 S- b) o
A. 0
- y2 L; |) g6 w" j" IB. 1
3 c+ b0 q) s1 t. R+ c2 h, `C. 2
2 i% F) a% t# I( ^- q& T: n; OD. 3
7 R2 ?% Z y( b8 ]E. 4
& N; @" N6 h& {) A6 C6 y 满分:4 分+ X" b- a8 ^1 {* B) p
19. 关系数据库管理系统应能实现的专门关系运算包括()- f2 l* w1 j! S; ?" j
A. 排序、索引、统计6 Z$ t- J+ }9 `) q9 T- A7 v
B. 选择、投影、连接
7 i. a8 c# {9 m2 e+ N) uC. 关联、更新、排序
, }: u: q* { M( S# wD. 显示、打印、制表
8 B6 k% s* J# A% r 满分:4 分
3 T! B) ~7 Z3 Y" f* j20. Given the following table: CREATE TABLE employee (name CHAR(10), salary DEC NOT NULL WITH DEFAULT) INSERT INTO employee (name, salary) VALUES ('SMITH', 30000) INSERT INTO employee (name) VALUES ('JONES') INSERT INTO employee (name, salary) VALUES ('ALI', 35000) Which of the following statements will retrieve more than one row?1 N; H: {* `' a E h# f
A. SELECT salary FROM employee WHERE salary IN (SELECT (salary/(SELECT SUM(salary) FROM employee)) FROM employee), ]8 c1 w8 D: x' U
B. SELECT COALESCE(AVG(salary)) FROM employee
! y( v# G3 o5 d" H5 R% E3 _C. SELECT SUM(salary)/COUNT(*) FROM employee% G3 c4 h# d3 A8 G {
D. SELECT salary/(SELECT SUM(salary) FROM employee) FROM employee2 o9 ~: L4 z3 L6 g7 N8 T! ?
满分:4 分$ b- R: X: m9 i" ~8 j
21. 在客户端直接连接到DB2 UDB服务器的环境中,服务器端的认证类型为以下哪个时,在编目时指定的认证类型不一定要与服务器端认证参数的值相匹配。$ E. O2 {6 [: i- p
A. SERVER_ENCRYPT" h7 a$ u4 a) t& y' D
B. DCE, ^/ \; j2 Z- d% B4 R) z
C. DCE_SERVER_ENCRYPT( X$ h7 M, Y+ @: d6 z
D. KERBEROS
( U+ c* g# t: t; I+ i0 P 满分:4 分
. w" a) j1 ?! V22. 数据库系统的独立性是指():
! n! x) a% \/ V YA. 不会因为数据的变化而影响应用程序
5 }8 p9 b) _) A4 |8 ?B. 不会因为系统数据存储结构与数据逻辑结构的变化而影响应用程序6 u' {% L- h& {3 j/ E
C. 不会因为存储策略的变化而影响存储结构! j- h3 `! ~$ q# ^( I; A, y
D. 不会因为某些存储结构的变化而影响其它的存储结构
8 k. U% @ q" D6 S E 满分:4 分
4 A9 L* k9 q' a. p23. Which of the following methods must be used for deleting a row using the Statement interface in JDBC?( p0 ~) P8 s3 Y3 H9 c+ ?
A. delete()1 \2 K+ n) p+ o! T' ~
B. execute()9 }" c+ O. F9 x5 k. I
C. executeUpdate()/ W: a/ [3 F! i; S: _9 J( Q! r; l
D. executeDelete()7 L% E _% T* p& |; T
满分:4 分
$ m/ k1 h3 h& T. Z3 ?$ Z- x8 N24. 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?
+ P6 J/ _/ Z9 ]* sA. 16 @9 U$ ]6 `2 R
B. 2. r3 K# H0 b" w. Y: V1 Y
C. 3
$ E0 P) h1 r3 G, k2 h; ?D. 4
A. O/ P8 ?2 N 满分:4 分# p8 w0 T C: q# M2 u* H# X
25. DBMS是()# N( Y$ M; D& v" e) O
A. 操作系统的一部分
: I/ x3 z e3 h' XB. 在操作系统支持下的系统软件8 t8 M/ l" _7 M I% D) @
C. 一种编译程序$ o0 }: r$ ~& ^- V$ t
D. 应用程序系统
% h4 [. G. R0 ]6 ~6 `4 Y 满分:4 分
) z1 L* V$ u; `) s* m: \+ ~6 p) B. s9 h$ P
如果资料还未上传请加QQ:1306998094 谢谢 |
|