吉大16秋《数据库应用技术》在线作业答案
吉大16秋学期《数据库应用技术》在线作业二一、单选题:
1.在客户端直接连接到DB2 UDB服务器的环境中,服务器端的认证类型为以下哪个时,在编目时指定的认证类型不一定要与服务器端认证参数的值相匹配。 (满分:4)
A. SERVERENCRYPT
B. DCE
C. DCESERVERENCRYPT
D. KERBEROS
2.给出下面信息: CREATE TABLE tab1(c1 char(3) WITH DEFAULT NULL, c2 INTEGER); INSERT INTO tab1(c2) VALUES(‘345’); 如果在命令行处理器(CLP)中执行以下语句,以下哪个结果是正确的?SELECT * FROM tab1; (满分:4)
A. C1C2 --- ----------- 0 record(s) selected.
B. C1C2 --- ----------- 123 345 1 record(s) selected.
C. C1C2 --- ----------- 345 1 record(s) selected.
D. C1C2 --- ----------- - 345 1 record(s) selected.
3.下列那种隔离级对于只读操作不在数据行上加锁? (满分:4)
A. RR
B. RS
C. CS
D. UR
4.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? (满分:4)
A. SQLCODE 0
SQLSTATE 00000
B. SQLCODE 100
SQLSTATE 02000
C. SQLCODE -100
SQLSTATE 00100
D. SQLCODE -501
SQLSTATE 24501
5.对于支持小规模的部门级应用,这些应用不需要存取驻留在OS/400、OS/390等平台上的远程数据库,则需要哪种级别的DB2 产品? (满分:4)
A. 企业版
B. 工作组版
C. 企业扩展版
D. 个人版
E. 卫星版
F. 微型版
6.事务的原子性是指( ) (满分:4)
A. 事务中包含的所有操作要么都做,要么都不做
B. 事务一旦提交,对数据库的改变是永久性的
C. 一个事务内部的操作及使用的数据对并发的其他事务是隔离的
D. 事务必须是使数据库从一个一致性状态变到另一个一致性状态
7.游标稳定性(CS,或称光标稳定性)隔离级锁定工作单元期间光标所在的任何行。对该行的锁定将( ) (满分:4)
A. . 不保持
B. . 保持到取出下一行记录或整个工作单元终止。
C. . 保持到整个工作单元终止。
8.下列哪种工具可以向表中增添记录,并更改数据库的统计信息? (满分:4)
A. import
B. insert
C. load
D. update
9.定义基本表时,若要求某一列的值不能为空,则应在定义时使用什么保留字?但如果该列是主键,则可省写。 (满分:4)
A. NULL
B. NOT NULL
C. DISTINCT
D. UNIQUE
10.Which of the following privileges is required to successfully execute a Java stored procedure that uses JDBC to update several different tables? (满分:4)
A. The user must have UPDATE privilege on the referenced tables.
B. The developer must have EXECUTE privilege on the stored procedure.
C. The user must have UPDATE privilege on the referenced tables and EXECUTE privilege on the stored procedure.
D. The developer must have UPDATE privilege on the referenced tables and EXECUTE privilege on the stored procedure.
11.If a stored procedure returns multiple rows, which of the following must the calling application use to access the result set? (满分:4)
A. A cursor
B. A select statement
C. A declared temporary table
D. A table user-defined function
12.Given the code: EXEC SQL DECLARE cursor1 CURSOR FOR SELECT name,age,bdate FROM person; EXEC SQL OPEN cursor1; Under which of the following situations will the above cursor be implicitly closed? (满分:4)
A. When a CLOSE statement is issued
B. When a COMMIT statement is issued
C. When there are no rows in the result set
D. When all rows are FETCHed from the result set
13.Given the tables, the relationships and the statements: EMPLOYEE DEPT empnum empname dept deptid deptname 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.deptid. 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? (满分:4)
A. One row is inserted in EMPLOYEE
B. No rows are inserted in EMPLOYEE
C. Two rows are inserted in EMPLOYEE
D. One row is inserted in DEPT and 2 rows are inserted in EMPLOYEE
14.Which of the following database resources can be freed when a unit of work is committed? (满分:4)
A. row locks
B. cursor names
C. buffer pools
D. cursors WITH HOLD
15.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)
A. 0
B. 3
C. 4
D. 5
16.下面哪一工具允许用户开发存储过程? (满分:4)
A. 控制中心
B. 命令中心
C. 任务中心
D. 开发中心
E. 健康中心
17.当数据库遭到破坏时,为了能迅速恢复,在进行事务处理过程中将对数据库更新的全部内容写入以下哪项? (满分:4)
A. 副本文件
B. 日志文件
C. 检查点文件
D. 死锁文件
18.数据库系统的独立性是指( ): (满分:4)
A. 不会因为数据的变化而影响应用程序
B. 不会因为系统数据存储结构与数据逻辑结构的变化而影响应用程序
C. 不会因为存储策略的变化而影响存储结构
D. 不会因为某些存储结构的变化而影响其它的存储结构
19.Which of the following will retrieve results that will only be in lower case? (满分:4)
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 EMPLOYEE WHERE LCASE(NAME)=LCASE('ALI'))
20.To prepare an embedded SQL program for use with a host-language compiler, which of the following database components is required? (满分:4)
A. Binder
B. Precompiler
C. Stored Procedure Builder
D. Application Development Center
21.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? (满分:4)
A. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDATE OF t2
B. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDATE OF c2
C. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDATE OF c1
D. DECLARE c2 CURSOR WITH HOLD FOR SELECT * FROM t2 FOR UPDATE OF t2
22.下述关于数据库系统的正确叙述是( ) (满分:4)
A. 数据库中只存在数据项之间的联系
B. 数据库的数据项之间和记录之间都存在联系
C. 数据库的数据项之间无联系,记录之间存在联系
D. 数据库的数据项之间和记录之间都不存在联系
23.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 theremote 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? (满分:4)
A. FOO requires EXECUTE privilege on the package.
B. FOO requires the privilege to create the package on the remote DB2 server.
C. FOO requires EXECUTE privilege on the package and INSERT privilege on CUST.ORDERS.
D. FOO requires the privilege to create the package on the remote DB2 server and INSERT privilege on CUST.ORDERS.
24.嵌入式SQL语句中引用共享变量时,必须在变量名前加什么标志? (满分:4)
A. 号
B. 分号
C. 句号
D. 冒号
25.Which of the following CLI/ODBC functions should be used to delete rows from a DB2 table? (满分:4)
A. SQLDelete( )
B. SQLExecDirect( )
C. SQLBulkDelete( )
D. SQLExecuteUpdate( )
吉大16秋学期《数据库应用技术》在线作业一
一、单选题:
1.对于UNIX和Intel平台上的数据库应用,如果需要存取OS/400、VM/VSE和OS/390系统上的数据库,需要DB2哪种产品的支持? (满分:4)
A. DB2Connect
B. DB2 DataPropagator
C. DB2 Net.Data
D. DB2 DataJoiner
E. DB2 Relational Connect
2.A cursor is declared with the WITH HOLD option. Which of the following statements is always true? (满分:4)
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.
3.发人员开发访问后台AIX上的DB2的windows程序,需要在windows开发平台上安装: (满分:4)
A. DB2运行时间客户端
B. DB2管理客户端
C. DB2应用程序开发客户端
D. DB2瘦客户端
4.Given the following table: TestTable C1 ----------- 12345 And if the following CLI calls are made: SQLAllocHandle(SQLHANDLEENV,SQLNULLHANDLE,&henv); SQLSetEnvAttr( henv, SQLATTRODBCVERSION,(SQLPOINTER) SQLOVODBC3,0); SQL AllocHandle(SQLHANDLEDBC,henv,&hdbc); SQLConnect( hdbc,(SQLCHAR *)"db", SQLNTS,(SQLCHAR *)"userid", SQLNTS,(SQLCHAR *)"password", SQLNTS ); SQLSetConnectAttr( hdbc, SQLATTRAUTOCOMMIT, SQLAUTOCOMMITOFF, 0); SQLAllocHandle(SQLHANDLESTMT,hdbc,&hstmt); SQLPrepare(hstmt,(unsigned char*)"select *from Test order by C1',SQLNTS); SQLBindCol(hstmt,1,SQLCSHORT,&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(SQLHANDLEENV,henv,SQLCOMMIT); SQLFetch(hstmt); printf(Data:%i\n",data); Which of the following will be returned by the program? (满分:4)
A. Data
5.The following commands are issued against a data source: CREATE TABLE userid.org( i INT) CREATE ALIAS user1.org FOR userid.org CREATE TABLE org.sample( c CHAR(1)) CREATE ALIAS sample.org FOR userid.org CREATE ALIAS userid.sample FOR sample.org When issued by USER1, which of the following statements will have a different result set than this SELECT statement? SELECT * FROM org (满分:4)
1 Data
6.DBMS是( ) (满分:4)
2 Data
7.嵌入式SQL语句中引用共享变量时,必须在变量名前加什么标志? (满分:4)
3 Data
8.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? (满分:4)
3
B. Data
9.Given the tables: COUNTRY STAFF id name person cities id name 1 Argentina 1 10 1 Aaron 2 Canada 2 20 2 Adams 3 Cuba 2 10 3 Jones 4 Germany 1 0 5 France 3 5 6 Italy 1 5 the report: id name numberofcountries ---------- ---------- ------------------- 1 Aaron 3 and the SQL statement: SELECT B.id,B.name,COUNT(DISTINCT A.name) AS numberofcountries FROM country A, staff B WHERE B.id=A.person GROUP BY B.id,B.name HAVING COUNT(DISTINCT A.name)>:countvar Which of the following values does :countvar require to print out the above report? (满分:4)
1 Data
10.Which of the following is used to run an embedded dynamic SQL UPDATE statement? (满分:4)
2 Data
11.How many rows can be retrieved using a single SELECT INTO statement? (满分:4)
3 Data
12.下面哪个工具可以帮助用户对语句性能进行分析? (满分:4)
4
C. Data
13.下列那种隔离级对于只读操作不在数据行上加锁? (满分:4)
1 Data
14.给定三个表:学生表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语句是哪个? (满分:4)
2 Data
15.Which of the following is a benefit of user-defined functions? (满分:4)
3 Data
16.Given the table T1 with the following data: COL1 IDX ---- ---- A single-threaded CLI application executes the following pseudocode in sequence: SQLAllocHandle( SQLHANDLEENV, NULL, &hEnv ) SQLAllocHandle( SQLHANDLEDBC, hEnv, &hDbc ) SQLConnect( hDbc, "SAMPLE", SQLNTS, NULL, SQLNTS, NULL, SQLNTS ) SQLSetConnectAttr( hDbc, SQLATTRAUTOCOMMIT, SQLAUTOCOMMITON ) SQLAllocHandle( SQLHANDLESTMT, hDbc, &hStmt ) SQLExecDirect( hStmt, "UPDATE table1 SET col1=10 WHERE idx=1", SQLNTS ) SQLExecDirect( hStmt, "UPDATE table1 SET col1=20 WHERE idx=2", SQLNTS ) SQLEndTran( SQLHANDLEDBC, hDbc, SQLCOMMIT ) SQLExecDirect( hStmt, "UPDATE table1 SET col1=30 WHERE idx=1", SQLNTS ) SQLExecDirect( hStmt, "UPDATE table1 SET col1=40 WHERE idx=1", SQLNTS ) SQLEndTran( SQLHANDLEDBC, hDbc, SQLROLLBACK ) SQLExecDirect( hStmt, "SELECT col1 FROM table1 WHERE idx=1", SQLNTS ) Which of the following values for COL1 will be fetched when the sequence for the pseudocode listed above is successfully executed? (满分:4)
1
D. Data
17.如果选用循环日志方式,辅助日志文件何时分配? (满分:4)
1 Data
18.Given the code: EXEC SQL WITH mostcities AS( SELECT b.id, b.name, a.cities FROM country a, staff b WHERE a.person = b.id AND cities > :threshold ) SELECT id, name, cities FROM mostcities INTO :id, :name, :cities WHERE cities IN(SELECT MAX(cities) FROM mostcities) Which of the following can reference MOSTCITIES? (满分:4)
2 Data
19.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? (满分:4)
3 Data
20.要对应用程序预编译并生成绑定文件,需要什么特权? (满分:4)
5
21.当数据库遭到破坏时,为了能迅速恢复,在进行事务处理过程中将对数据库更新的全部内容写入以下哪项? (满分:4)
A. SELECT * FROM org.sample
B. SELECT * FROM sample.org
C. SELECT * FROM userid.org
D. SELECT * FROM userid.sample
22.事务的原子性是指( ) (满分:4)
A. 操作系统的一部分
B. 在操作系统支持下的系统软件
C. 一种编译程序
D. 应用程序系统
23.定义基本表时,若要求某一列的值不能为空,则应在定义时使用什么保留字?但如果该列是主键,则可省写。 (满分:4)
A. 号
B. 分号
C. 句号
D. 冒号
24.数据操纵语言的基本功能中不包括( ) (满分:4)
A. 5
B. 6
C. 10
D. 36
25.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? (满分:4)
A. 1
B. 2
C. 3
D. 4
**** Hidden Message *****
页:
[1]