|
吉大11春学期《数据库应用技术》在线作业二资料 c8 R: q$ }- z; {
在线作业, 数据库, 单选题, 资料% C$ A( r' ?* a
一、单选题(共 25 道试题,共 100 分。)V 1. 在SELECT语句的下列子句中,通常和HAVING子句同时使用的是以下哪项?
- u: Q4 e2 V' x9 e* x* d) I, ]5 iA. ORDER BY子句
4 M: D- V3 s. O3 `; E( y8 f! QB. WHERE子句
+ g+ I& v. K0 I$ b/ O3 {! e' cC. GROUP BY子句6 P% s3 e( q* c* C+ V
D. 均不需要+ u4 g* a( `* `9 S
满分:4 分
3 s3 l: x5 e, S8 m: C' [( ]2. Which of the following is TRUE for all cursors defined as FOR FETCH ONLY?
2 `$ _+ u0 X/ L) K; bA. The cursors are unambiguous./ e% f4 v; C# x& K" d' m" B
B. Only the first row is returned.
* h" K- `- h/ I. ?- t, M9 IC. Cursor stays open after a commit.6 \5 q$ G7 ~6 ~1 ]& ~5 g
D. A temporary table is created on the server.) L" c2 o; |: L* L0 E
满分:4 分3 {% h( v" z7 C
3. 对于支持小规模的部门级应用,这些应用不需要存取驻留在OS/400、OS/390等平台上的远程数据库,则需要哪种级别的DB2 产品?/ R2 W g3 [& b/ N4 N1 U8 O+ M
A. 企业版
8 M3 K' M1 v/ w5 j: e# x- `9 ZB. 工作组版
$ \, O, W2 Y, i, m7 R0 cC. 企业扩展版
4 c$ f9 o5 `$ P6 n! A5 D4 k! uD. 个人版
( }$ ^ @6 Z9 XE. 卫星版
/ R. `" s. S/ K# u6 @F. 微型版3 A' Y5 B2 w( f. n" p, V9 K
满分:4 分
! ]1 U. v/ h$ N. ^; ~4. The following commands are issued against a data source containing table user2.org: CREATE ALIAS user1.org FOR sample.org CREATE TABLE org.sample ( c CHAR(1)) CREATE ALIAS sample.org FOR user2.org CREATE ALIAS user2.sample FOR sample.org Given the user SAMPLE issues the following statement: SELECT * FROM sample For which of the following database objects will access be attempted?
9 P5 X+ j! |& j4 M9 H0 tA. user2.org
/ U* G% X n) U. K* bB. org.sample' L% j% f% L f
C. sample.org
6 [# V+ ~9 q8 | i) }6 J* C1 aD. sample.sample' k2 I+ D2 I" S$ X3 h% T2 I- C
满分:4 分0 q; `1 f1 o k1 ?4 T# \
5. A cursor is declared with the WITH HOLD option. Which of the following statements is always true?
8 m b& `& y& QA. The cursor will remain open after a COMMIT.
! b/ D; S$ |6 Z( C5 [B. All rows retrieved are locked until a COMMIT.
. I) @" W) F3 z6 Z( i& DC. A COMMIT will not be allowed until the cursor is closed.
" F! f* j* S# H, [3 mD. Locks obtained by the cursor will be kept after a COMMIT.
# V m; e% o1 Y; U: p) m% l 满分:4 分
9 c# J, s2 M/ d- z; h6. 使用SQL语句进行查询操作时,若希望查询结果不出现重复元组,应在SELECT子句中使用什么保留字?/ C- @2 B/ t$ {; }
A. NIQUE9 y& h* z6 t" R0 U3 }
B. ALL
* h4 l$ M% J) @" gC. EXCEPT7 ]0 h% n2 l! c- r: ?8 t- O( }) V
D. DISTINCT
5 Y4 M# W$ L! [3 {7 `4 m 满分:4 分1 h* J' U F9 H% I
7. 如果用户在SQL语句中没有指定数据库对象的SCHEMA,则其缺省的SCHEMA是:1 f/ V! }% ^( p
A. SYSIBM2 y( a4 c8 a' o) Q! b& O
B. SYSCAT
- _7 c" _% \% D- p# VC. SYSSTAT5 z' [: e& B4 D6 W$ [" D8 S7 `/ U/ ^
D. 该用户连接到数据库时所使用的用户名% Q2 N, q0 Q7 ]4 d- P- i
E. 以上都不对+ s% j1 a' f8 j8 S
满分:4 分
* f3 J9 m) C, W0 c4 z% ~8. 数据库系统的并发控制的主要方法是采用()制。3 Q5 T6 C' v: U; Y7 r4 Z' M
A. 拒绝
! d4 {! ], j6 G( QB. 改为串行
$ ^7 a' v5 h2 v+ O6 h9 h1 XC. 锁2 z' p" z! q( o* l' ^
D. 不加任何控制
, ]1 \/ |+ h; x. m# [! h8 P1 x+ Y 满分:4 分; H$ l! W2 h5 c3 m0 j( z n
9. 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?/ I9 s! R! [ @
A. user tables# `! k4 R' Z+ K. k
B. server memory
) |! k4 l! ~0 {) _2 }5 nC. user table space
4 ?# ?, o. K; v% v S: j4 I3 sD. system catalog tables- I0 ?1 o6 [. H2 |3 l
满分:4 分
7 m2 [. F' p4 O: ^( m7 h7 g5 }10. 关系模式中各级模式之间的关系为()) }: B. d# n: n" n$ S! V3 }/ H
A. 3NF 2NF 1NF
' m" ^3 r+ k* V9 } D* o6 OB. 3NF 1NF 2NF2 h# r; s5 u- d) l
C. 1NF 2NF 3NF
) x3 p2 ]$ I0 b* n: k+ uD. 2NF 1NF 3NF
# ~% ^0 {, G) S3 D* j0 c/ v8 C 满分:4 分- z) s) t% U/ `" s+ O
11. 创建一个DMS类型的表空间,可以使用以下哪两种文件系统对象作为容器?
/ `8 z! E; j) L1 cA. 目录 b' O4 ]8 ?2 Q8 b* C
B. 文件
2 g4 i2 d6 o& zC. DEVICE! O2 j7 R( B+ G9 O# Y
满分:4 分
8 b2 L" b' L- j o12. 执行下面两条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上有几个索引?; K N4 s% n+ ~$ x _6 L
A. 0: R& f8 G+ i2 C) U$ T4 M4 p5 v
B. 17 {$ S" X9 H: r
C. 21 o8 ^9 {( t& s- d
D. 3( I& _( {. u) `6 q5 x, ~( K6 U
E. 4* S* k0 q6 c1 W# k: S* b6 {# H" L
满分:4 分
7 @' l1 H6 t/ k$ A) T8 J" W1 ]0 F13. 缺省的数据库日志文件的类型是:
) ?& t* r- l# f: k( b' VA. Circular Log5 ~+ y- }# t9 A. x/ w
B. Archival Log. h: R9 g& a/ R2 A, j/ k0 l
C. Primary Log
1 a7 V# E3 o# x. xD. Secondary log; r, F$ c! S; Z
满分:4 分
: A! D6 g1 {$ D# y: i/ E14. An application uses embedded dynamic SQL to connect to a remote DB2 server and inserts data into the CUST.ORDERS table on that remote DB2 server. To enable access of the remote DB2 server, Administrator FOO needs to create a package with default options such that BAR is the only non-administrative user that can use this package on the remote DB2 server. Which statement describes the privileges that must be granted and/or revoked by FOO to accomplish this?5 b! R( ?3 R/ F9 I, p* M! [7 O
A. BAR requires EXECUTE privilege on the package and UPDATE privilege on CUST.ORDERS, and the EXECUTE privilege for the package must be revoked from PUBLIC.
/ X: I" z9 I& i4 O6 t7 dB. BAR requires EXECUTE privilege on the package and INSERT privilege on CUST.ORDERS, and the EXECUTE privilege for the package must be revoked from PUBLIC.
$ e J' @5 E' U" i. EC. BAR requires EXECUTE privilege on the package and INSERT privilege on CUST.ORDERS, and the REFERENCES privilege for the package must be revoked from PUBLIC.. j0 ?" @% c) X. Q" x/ C! l
D. BAR requires EXECUTE privilege on the package and UPDATE privilege on CUST.ORDERS, and the REFERENCES privilege for the package must be revoked from PUBLIC.& G% [8 w, N I, Z9 h8 Y
满分:4 分
! Z( r3 n1 }, K1 S& x15. 给定三个表:学生表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语句是哪个?. c' C6 z2 w& c
A. SELECT S# FROM SC WHERE C#=“C2” AND GRADE >= (SELECT GRADE FROM SC WHERE C#=” C2”)
, f. ` g1 E! |6 N/ M) h/ `B. SELECT S# FROM SC WHERE C#=”C2” AND GRADE IN (SELECT GRADE FROM SC WHERE C#=”C2”)! F2 y' B$ @! ?0 e" W* i7 D
C. SELECT S# FROM SC WHERE C#=”C2” AND GRADE NOT IN (SELECT GRADE FROM SC WHERE C#=”C2”)
b0 @3 [! C- b7 `6 VD. SELECT S# FROM SC WHERE C#=”C2” AND GRADE>=ALL (SELECT GRADE FROM SC WHERE C#=”C2”)
0 e; O$ u' ?, u6 r% @/ b9 r! y5 t 满分:4 分
4 T0 b! B. y& l# }2 S2 ?16. 数据库系统的独立性是指():
! _* F) O: n# ~A. 不会因为数据的变化而影响应用程序
* K! L: l4 x5 g/ nB. 不会因为系统数据存储结构与数据逻辑结构的变化而影响应用程序9 t% q5 E4 z" I* L
C. 不会因为存储策略的变化而影响存储结构7 f( u' e0 q8 {, K6 U$ O
D. 不会因为某些存储结构的变化而影响其它的存储结构1 c# ?9 y" o& h6 b. k' V; H. t
满分:4 分
; B5 `$ A0 t* o& x17. 若用如下的SQL语句创建一个student表: CREATE TABLE student(NO CHAR(4) NOT NULL, NAME CHAR(8) NOT NULL, SEX CHAR(2), AGE NUMBERIC(2))可以插入到student表中的是哪一项?- r/ Q2 M) N6 }; D! J' o+ [, w
A. (‘1031’,‘曾华’,男,23): V% j& @8 Q" l6 w' {" n9 C
B. (‘1031’,‘曾华’,NULL,NULL): o1 N! \, [% {; u3 m" N8 X( g1 n
C. (NULL,‘曾华’,‘男’,‘23’)) \8 a; b+ I! o: c S
D. (‘1031’,NULL,‘男’,23)) Q( E" c9 r' {( K
满分:4 分
4 Y. q' {( D a8 p# l/ J w18. Given the table COUNTRY with the following data: ID NAME PERSON CITIES -- ---- ------ ------ 1 Argentina 1 - and the code: EXEC SQL DECLARE c1 CURSOR FOR SELECT id,name FROM country; EXEC SQL OPEN c1; EXEC SQL FETCH c1 INTO :id,:name; EXEC SQL FETCH c1 INTO :id,:name; Which of the following SQLCODE/SQLSTATEs will be contained in the SQLCA after the last fetch?0 s4 S# K( \! S, a
A. SQLCODE 0, SQLSTATE 00000
+ o& h4 {6 e$ {8 K- ~1 wB. SQLCODE 100, SQLSTATE 02000- w$ O) {0 }" J) n
C. SQLCODE -100, SQLSTATE 00100
+ T* K7 \% H* Y' r1 x! ED. SQLCODE -501, SQLSTATE 24501# _6 b' ^; {- s8 b {$ Y% W# d
满分:4 分- i2 b3 g* w: i2 |3 C5 k
19. Given the tables, the relationships and the statements: 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 Relationship: employee.dept is a foreign key on dept.dept_id. stmt="INSERT INTO employee VALUES (5,'jones',3)"; EXEC SQL EXECUTE IMMEDIATE :stmt; stmt="INSERT INTO employee VALUES (6,'jhonson',2)'; EXEC SQL EXECUTE IMMEDIATE :stmt; How many rows are successfully inserted?* t7 u& t, C& h5 F6 x9 `
A. One row is inserted in EMPLOYEE
/ D* a }( a1 u7 B- X- m! sB. No rows are inserted in EMPLOYEE6 y$ A% K' Y. G! ~3 i( F0 L# j
C. Two rows are inserted in EMPLOYEE3 |+ h4 H! Q& {* e# n3 T
D. One row is inserted in DEPT and 2 rows are inserted in EMPLOYEE& ]5 C6 B7 F' j( R, S
满分:4 分6 j$ J9 Q* [8 T5 N
20. 下列那种隔离级对于只读操作不在数据行上加锁?' d: l$ P! M/ e6 Q( Y
A. RR3 A! p5 \- m9 D% J: Q5 a7 j
B. RS
6 y( U8 x( G. g4 {1 o& I$ t! EC. CS
. }7 \$ k3 b8 eD. UR
" z# v9 X& _, d! [. j' R- j3 Q, M5 g 满分:4 分4 P9 x* i- v* ~3 H4 i
21. 如果想在数据导入的过程中创建表,应该
* U8 j) V. l" LA. 使用IXF文件格式进行LOAD3 K5 w+ b+ Q0 Y* J$ W9 K! S# M- _
B. 使用WSF文件格式进行LOAD
9 K$ | k! S/ G! _% jC. 使用IXF文件格式进行IMPORT
7 Z% Y( i" p1 ~$ Y6 ^8 t& A9 J3 h0 qD. 使用WSF文件格式进行IMPORT
) X. H/ J( K! @8 J+ ] 满分:4 分
3 E$ |- i I7 {# T1 j! e1 T22. 下面哪一工具允许用户开发存储过程?. Y+ Z. B7 D$ K
A. 控制中心
9 A; Q4 _3 l' I) s# cB. 命令中心( x. h6 ]& F" D* y c6 U
C. 任务中心
1 h; r( x3 p" V- \% t/ W5 o: S# mD. 开发中心; N$ K s- ^3 J. b/ i* w
E. 健康中心, x/ L9 O5 H# B2 l# |* |
满分:4 分/ ^5 J/ h6 m2 c1 o4 M0 v1 {1 ]
23. Which of the following CLI/ODBC functions should be used to delete rows from a DB2 table?: f2 o0 K0 y; V4 u6 u& ]: e! E% w
A. SQLDelete() u: T" v. L# P: A( K$ n( p
B. SQLExecDirect()8 s8 J. q( P7 l7 V) X" j
C. SQLBulkDelete()
D/ Z7 l0 ^' f1 hD. SQLExecuteUpdate()
3 k$ o0 E; ~# T* u- | 满分:4 分3 }/ A a6 a* r9 w7 @
24. Given the EMPLOYEE table definition: CREATE TABLE employee ( workdept CHAR(30), salary INTEGER ) Which of the following is a correct usage of parameter markers in a JDBC program?
2 F0 m$ K) D% Z6 CA. String sql = "UPDATE employee SET salary=salary*?WHERE workdept=?"; statement stmt=con.createStatement(sql);1 r5 v0 K; j" P
B. String sql = "UPDATE employee SET salary=salary*?WHERE workdept=?"; statement stmt=con.createStatement(sql);
- `* A0 i% I* u+ g" \3 L8 [C. String sql = "UPDATE employee SET salary=salary*?WHERE workdept=?"; statement stmt=con.createStatement(sql);
( h' f1 t5 o# o* n' VD. String sql = "UPDATE employee SET salary=salary*?WHERE workdept=?"; statement stmt=con.createStatement(sql);" V3 N% B# \/ b: o! X6 ~9 C# l
满分:4 分
6 D$ O* R) ]6 ^7 S25. 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 c28 m1 _$ o7 r; M7 R( O( p ~) w+ D6 O8 Y
A. 10 1 20 2* ~( o! t9 A/ d1 W
B. 30 1 50 3; A6 q6 C y/ I: h& i+ [
C. 30 1 40 3
2 v" [( X( z2 W3 D7 ^6 R+ GD. 10 1 50 3
; K! f, |0 d" h S 满分:4 分 |
|