SSD7半期试题2010(周5下午用) 下载本文

内容发布更新时间 : 2024/9/18 19:08:30星期一 下面是文章的全部内容请认真阅读。

四川大学期中考试试题(闭卷)

(2008-2009学年第2学期)

课程号: 31113740 课序号: 课程名称 数据库系统原理(A卷) 适用专业年级:软件工程2007级

学生人数: 印题份数:

学号: 姓名:

任课教师:

考试须知

四川大学学生参加由学校组织或由学校承办的各级各类考试,必须严格执行《四川大学考试工作管理办法》和《四川大学考场规则》。

有考试违纪作弊行为的,一律按照《四川大学学生考试违纪作弊处罚条例》进行处理。

四川大学各级各类考试的监考人员,必须严格执行《四川大学考试工作管理办法》、《四川大学考场规则》和《四川大学监考人员职责》。有违反学校有关规定的,严格按照《四川大学教学事故认定及处理办法》进行处理。

题 号 得 分 阅卷教师 阅卷时间 总 成 绩

一 100

Problem 1. Multiple Choices. (2points×15)

1. If relation R has n tuples and relation S has m tuples, the maximum number of tupes that R-S can

contain is _____.d (a)n (b)m (c)n+m (d) |n-m| 2. For two tables to be union compatible, corresponding columns from each table should have which of

the following? a

(a) the same domain (b) the same name (c) different domains (d) different names

3. Which of the following is true about primary keys and foreign keys holding NULL value?d (a) A primary key cannot hold a NULL value and a foreign key cannot hold a NULL value (b) A primary key can hold a NULL value and a foreign key can hold a NULL value (c) A primary key can hold a NULL value and a foreign key cannot hold a NULL value (d) A primary key cannot hold a NULL value and a foreign key can hold a NULL value 4. What does a projection operation do?d

(a) It extends the number of columns in a table. (b) It selects rows from a table. (c) It extends the number of rows in a table. (d) It selects columns from a table.

5. With respect to a relational table, what is a key?a (a) A minimal subset of columns that uniquely identifies a row in the table (b) The ID and password needed to access the table

(c) The subset of all the rows and columns in the table that are visible to all users in the database system (d) The one column that uniquely identifies a row in the table

6. An insertion operation will _____ if the insertion violates the uniqueness property of a key.a (a) fail (b) succeed with warning (c) succeed without warning (d) crash the system

7. An insertion operation will _____ if the inserted primary key has a NULL value.b (a) succeed with warning (b) fail (c) crash the system (d) succeed without warning

8. In the relational model, which of the following is true about the data type of a column?b (a) It need not be atomic and it cannot be an abstract data type. (b) It must be atomic and it cannot be an abstract data type. (c) It must be atomic and it can be an abstract data type. (d) It need not be atomic and it can be an abstract data type.

9. Which of the following SQL commands can be used to change, add, or drop column definitions from a

table?a (a) ALTER TABLE (b) CHANGE TABLE (c) UPDATE TABLE (d) MODIFY TABLE

10. Which of the following is true about the physical storage of tables defined by views?d (a) There is no extra physical storage needed to store tables that a view defines. (b) Extra physical storage is always needed to store tables that a view defines.

(c) Extra physical storage is needed for storing the tables defined by views, only if views define additional non-existing

columns.

(d) Extra physical storage is needed to store tables that a view defines, only when rows are inserted into the view.

11. In SQL, the results of a _____ statement can be used to process a _____ statement.b (a) DELETE, INSERT (b) SELECT, INSERT (c) INSERT, SELECT (d) INSERT, DELETE

12. When a string whose length is strictly less than n is entered as the value of a field whose SQL data

type is CHAR(n), the system responds by c (a) re-prompting for the entry of a string whose length is exactly n

(b) padding the end of the string with NULL characters to length n before storing it (c) padding the end of the string with spaces to length n before storing it (d) storing the string as is

13. In SQL, which of the following operators are used to check for set membership in a SELECT statement?b (a) SUBSET and NOT SUBSET (b) IN and NOT IN

(c) MEMBER and NOT MEMBER (d) COMPONENT and NOT COMPONENT 14. In contrast to _____ tables, a view refers to _____.a

(a) base, a virtual table (b) non-empty, empty tables (b) non-empty, empty tables (d) virtual, base tables

15. When removing a table from the schema, using the CASCADE option would a (a) remove the table and all references to it.

(b) recursively remove the table and all other tables that the removed table refers to. (c) remove the table and all other tables that the specified table refers to. (d) remove the table if there are no references to it..

Problem 2. You will be working with the following schema:

Employee (SSN, name, salary, DNo) Department (DNo, DeptName, MgrSSN) Project (PNo, location, ProjName) HourLog (SSN, PNo, hours)

The Employee relation provides a list of employees with their SSN, name, salary, and department number (DNo). The SSN is unique for each employee. Each employee belongs to only one department. The Department relation contains a list of the departments for the company. Its schema includes a unique department number called DNo. It also includes the name of the department (DeptName) and the social security number of the department's manager (MgrSSN). Each department has a only one manager. The Project relation includes a unique project number (PNo), location and the project name (ProjName). An employee can be assigned to any number (including zero) projects. Each project has at least one person assigned to it. Finally, the HourLog relation lists for each project the number of hours of work for each employee who is assigned to that project. The key of this relation is SSN and PNo.

1. Write ralational algebra expressions to perform the follwing queries.