吉大15秋学期《数据库应用技术》在线作业一答案
一、单选题(共 25 道试题,共 100 分。)
1. DBMS是()
A. 操作系统的一部分
B. 在操作系统支持下的系统软件
C. 一种编译程序
D. 应用程序系统
正确答案:B
2. The following commands are issued against a data source: CREATE TABLE userid.org ( i INT) CREATE ALIAS user
1.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
A. SELECT * FROM org.sample
B. SELECT * FROM sample.org
C. SELECT * FROM userid.org
D. SELECT * FROM userid.sample
正确答案:A
3. 下面哪个工具提供了对文本、图象、音频、视频和XML文档等非传统数据类型的处理能力?
A. DB2 数据仓库中心
B. DB2数据链接管理器
C. DB2关系扩展器
D. DB2 OLAP Starter Kit
正确答案:C
4. 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?
A. SQLError()
B. SQLNumRows()
C. SQLRowCount()
D. SQLGetDiagField()
正确答案:D
5. 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?
A. 1
B. 2
C. 3
D. 4
正确答案:D
6. 给定三个表:学生表S,课程表C和学生选课表SC,它们的结构分别如下: S(S#,SN,SEX,AGE,DEPT) C(C#,CN) SC(S#,C#,GRADE)其中:S#为学号,SN为姓名,SEX为性别,AGE为年龄,DEPT为系别,C#为课程 号,CN为课程名,GRADE
为成绩。 对表SC建立如下视图: CREATE VIEW S_GRADE(S#,C_NUM,AVG_GRADE) AS SELECT S#,COUNT(C#),AVG(GRADE) FROM SC GROUP BY S#; 判断下面查询是否允许执行,如允许,写出转换到基本表SC上的操作。 SELECT S#,C_NUM FROM S_GRADE WHERE AVG_GRADE>80
A. 不允许查询。因为视图中使用了分组和聚合函数。
B. 允许。对应的操作为: SELECT S#,COUNT(C#) FROM SC WHERE AVG(GRADE)>80
C. 允许。对应的操作为: SELECT S#,COUNT(C#) FROM SC GROUP BY S# HAVING AVG(GRADE)>80
D. 允许。对应的操作为: SELECT S#, COUNT(C#) FROM SC HAVING AVG(GRADE)>80
正确答案:C
7. 下列哪种工具可以向表中增添记录,并更改数据库的统计信息?
A. import
B. insert
C. load
D. update
正确答案:C
8. 在SELECT语句的下列子句中,通常和HAVING子句同时使用的是以下哪项?
A. ORDER BY子句
B. WHERE子句
C. GROUP BY子句
D. 均不需要
正确答案:C
9. 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?
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
正确答案:A
10. If a stored procedure returns multiple rows, which of the following must 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
正确答案:A
11. 关系数据库管理系统应能实现的专门关系运算包括()
A. 排序、索引、统计
B. 选择、投影、连接
C. 关联、更新、排序
D. 显示、打印、制表
正确答案:B
12. 对于支持小规模的部门级应用,这些应用不需要存取驻留在OS/400、OS/390等平台上的远程数据库,则需要哪种级别的DB2 产品?
A. 企业版
B. 工作组版
C. 企业扩展版
D. 个人版
E. 卫星版
F. 微型版
正确答案:B
13. 关系模型中的关系模式至少是()
A. 1NF
B. 2NF
C. 3NF
D. BCNF
正确答案:A
14. Given the following table: TestTable C1 ----------- 12345 And if the following
CLI
calls
are
made:
SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&henv); SQLSetEnvAttr( SQL_OV_ODBC3,0);
henv,
SQL
SQL_ATTR_ODBC_VERSION,
(SQLPOINTER)
AllocHandle(SQL_HANDLE_DBC,henv,&hdbc);
SQLConnect( hdbc, (SQLCHAR *)\"db\SQL_NTS, (SQLCHAR *)\"userid\SQL_NTS, (SQLCHAR
*)\"password\
SQL_NTS
);
SQLSetConnectAttr(
hdbc, 0);
SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF,
SQLAllocHandle(SQL_HANDLE_STMT,hdbc,&hstmt); SQLPrepare(hstmt,(unsigned char*)\"select
*from
Test
order
by
C1',SQL_NTS); SQLExecute(hstmt);
SQLBindCol(hstmt,1,SQL_C_SHORT,&data,0,NULL);
SQLFetch(hstmt); printf(Data:%i\\n\SQLFetch(hstmt);
SQLEndTran(SQL_HANDLE_ENV,henv,SQL_COMMIT);
printf(Data:%i\\n\
SQLFetch(hstmt);
printf(Data:%i\\n\
A. Data: 1 Data: 2 Data: 3 Data: 3
B. Data: 1 Data: 2 Data: 3 Data: 4
C. Data: 1 Data: 2 Data: 3 Data: 1
D. Data: 1 Data: 2 Data: 3 Data: 5
正确答案:B
15. 当FROM子句中出现多个基本表或视图时,系统将执行什么操作?
A. 并
B. 等值联接
C. 自然联接
D. 笛卡儿积
正确答案:D
16. 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?
A. SELECT salary FROM employee WHERE salary IN (SELECT (salary/(SELECT SUM(salary) FROM employee)) FROM employee)
B. SELECT COALESCE(AVG(salary)) FROM employee
C. SELECT SUM(salary)/COUNT(*) FROM employee
D. SELECT salary/(SELECT SUM(salary) FROM employee) FROM employee
正确答案:D
17. 实体是信息世界中的术语,与之对应的数据库术语为:()
A. 文件
B. 数据库
C. 字段
D. 记录
正确答案:D
18. 若用如下的SQL语句创建一个student表: CREATE TABLE student(NO CHAR(4) NOT NULL, NAME CHAR(8) NOT NULL, SEX CHAR(2), AGE NUMBERIC(2))可以插入到student表中的是哪一项?
A. (‘1031’,‘曾华’,男,23)
B. (‘1031’,‘曾华’,NULL,NULL)
C. (NULL,‘曾华’,‘男’,‘23’)
D. (‘1031’,NULL,‘男’,23)
正确答案:B
19. Given the table T1, created using the following statement: CREATE TABLE t1 ( id INTEGER GENERATED BY DEFAULT AS IDENTITY, c1 CHAR(3) ) The following SQL statements are issued: INSERT INTO t1 VALUES (2, 'def') INSERT INTO t1 VALUES (DEFAULT, 'abc') INSERT INTO t1 VALUES (DEFAULT, 'ghi') Which of the following represents the order in which the values are returned from the following SELECT statement? SELECT id FROM t1 ORDER BY id
A. 1, 2, 2
B. 1, 2, 3
C. 2, 3, 4
D. 0, 1, 2
正确答案:A
20. 两个子查询的结果(),可以执行并、交、差操作
A. 结构完全一致
B. 结构完全不一致
C. 结构部分一致
D. 主键一致
正确答案:A
21. 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=1
A. 0
B. 1
C. 3
D. 4
正确答案:C
22. 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?
A. SELECT CAPS(lname) FROM name
B. SELECT UCASE(lname) FROM name
C. SELECT STRUPR(lname) FROM name
D. SELECT TOUPPER(lname) FROM name
正确答案:B
23. 关系模式中各级模式之间的关系为()
A. 3NF包含 2NF包含 1NF
B. 3NF包含 1NF包含 2NF
C. 1NF 包含2NF包含 3NF
D. 2NF包含 1NF 包含3NF
正确答案:A
24. To prepare an embedded SQL program for use with a host-language compiler, which of the following database components is required?
A. Binder
B. Precompiler
C. Stored Procedure Builder
D. Application Development Center
正确答案:B
25. 下述关于数据库系统的正确叙述是()
A. 数据库中只存在数据项之间的联系
B. 数据库的数据项之间和记录之间都存在联系
C. 数据库的数据项之间无联系,记录之间存在联系
D. 数据库的数据项之间和记录之间都不存在联系
正确答案:B
因篇幅问题不能全部显示,请点此查看更多更全内容