0% found this document useful (0 votes)
82 views9 pages

CIS 631 Database Management Systems Sample Final Exam

Uploaded by

mehari kiros
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views9 pages

CIS 631 Database Management Systems Sample Final Exam

Uploaded by

mehari kiros
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

CIS 631 – Database Management Systems

Sample Final Exam


1. (25 points) Match the items from the left column with those in the right and place the letters in the empty
slots.

k 1. Single-level index files a. Unary relationship

x 2. Data Mining b. Unordered, ordered, and hashed

z 3. Closure Set algorithm c. Domain, key, foreign key

f 4. Internal Schema d. Not absolutely essential in a model

n 5. BCNF e. No independent primary key

i 6. Super key f. The structure of the stored data and related retrieval
schema
e 7. Weak entity type g. Successive read/write of the same data from two
different transactions
a 8. Recursive relationship h. Interleaved schedule equivalent of a serial

o 9. Derived attribute i. Non-minimal primary key

w 10. Primary key j. Systematic examination of the functional


dependencies to establish the CK for the relation
s 11. Intersection relation k. Primary, Clustering , and Secondary

t 12. One-to-many relationship l. Same data to be modified in several places

q 13. Minimum cardinality of one m. The new tuple cannot be inserted in a relation based
on the current relation schema
v 14. B-trees and B+ trees n. Every determinant is a candidate key

r 15. ORDBMS o. Foreign key in either participating relation

b 16. Primary file organizations p. Non-PK attribute is the determinant of a Non-PK


attribute
c 17. DB’s necessary integrity constraints q. Mandatory (full) participation

a 18. One-to-one relationship r. Allows handling of more complex data

y 19. Many-to-many relationship s. Relation that contains tuples common in both


relations
m 20. Insertion anomaly t. PK of the parent entity placed in the child entity as
FK
z 21. 3NF compliance u. Relation (s) consistent with the 2NF requirements

l 22. Update anomaly v. Dynamic structures that allow an index to expand


and shrink
h 23. Serializeable schedule w. Cannot be NULL

g 24. Conflict in schedule x. Discovery of patterns and trends in the data

u 25. DB free of partial dependency y. Two foreign keys in a relationship table

e 26. Transitive dependency z. Eliminate partial and transitive dependencies

1
2. (15 points) Insert the following key values: 59, 23, 16, 28, 10, 1, 70, 79, 12, 19, 29, 72, 53, 45, and 90
into an initially empty B+-Tree in the given order. Suppose the orders of the B+-Tree are p = 4 and pleaf = 3.

insert 59

59

59 o

59 insert 23

23 o 59 o

59 insert 16

16 o 23 o 59 o

28 59 insert 28

16 o 23 o 28 o 59 o

2
3. (10 points) Given the following schedule:

S1: r2(X); r1(Y); w2(X); r3(X); w1(Y); w3(X); r2(Y); w2(Y);

a. Is S1 serializable? If yes, what is the serialized schedule like? Demonstrate your work with a
precedence graph.

This is not serializable because of the following cycle.

1 2 3

b. (10 points) Given the following schedule:

S2: r2(X); r1(Y); w2(X); r2(Y); r3(X); w1(Y); w3(X); w2(Y);

Is S2 serializable? If yes, what is serialized schedule like? Demonstrate your work with a
precedence graph.

This is not serializable because of the following cycle.

1 2 3

3
(Next 10 points are worth 2 points each)

4. Which of the following statements is false?

a. The data on secondary storage persists through power loss.


b. The primary memory is not large or reliable enough to store the quantity of data a typical
database might require.
c. The data stored in primary storage is not lost when power is lost.
d. Access time for primary storage is much faster than the secondary storage.

5. Which of the following does not correspond to a file organization?

a. Hash
b. Heap
c. ISAM
d. Sorted

6. Which of the following is false about heap files?

a. A heap file has no particular ordering with respect to a field value.


b. A linear search must be performed to access a record in a heap file.
c. Heap files are best for bulk loading data into a table.
d. When a record is deleted, the space is reused when inserting the next record.

7. Which of the following statements is true about a sorted file?

a. Inserting and deleting records in a sorted file is easy.


b. Ordered files are rarely used for DB storage unless a primary index is added to the file.
c. When a record is inserted in a sorted file, it is placed at the end of the file.
d. In general a linear search is more efficient than a binary search.

8. Which of the following statements is false about hash files?

a. A hash function calculates the address of the page on which the record is to be stored.
b. Each address generated by a hashing function corresponds to a page(bucket)
c. A hash function is chosen so that records are not evenly distributed in the table.
d. Several records can be placed in a bucket in order of arrival.

9. Which of the following statements is false?

a. The values in the index file are ordered according to the indexing field.
b. Primary index corresponds to a sequentially ordered data file and indexing field a key
field of the file.
c. Clustering index corresponds to a sequentially ordered data file and indexing field not
a key field of the file.
d. Secondary index corresponds to an index that is defined on an ordering field of the data
file.

4
10. Which of the following is not a B+-Tree rule?

a. If the root is not a leaf node, it must have at least two children.
b. The # of key values contained in a non-leaf nodes is 1 less than the number of pointers.
c. Different paths from root to leaves must have different lengths.
d. Leaf nodes are linked in order of key values.

11. Which of the following is true?

a. seek time + rotational latency = transfer time + access time

b. seek time + rotational latency + transfer time = access time

c. seek time + rotational latency + access time = transfer time

d. seek time = rotational latency + transfer time + access time

12. Match the following:

a. Seek time  b a. Time to move to the desires block

b. rotational time a b. Time to move to the desired track

c. Transfer time d c. Time to move to the block, track, and exchange

d. Access time c d. Time to read or write the data in the block

13. Match the following:

a. RAID level 0 b a. Uses block-level data striping across all disks

b. RAID level 1  c b. Lowest reliability and possibility of data loss

c. RAID level 3  d c. Improved read and slightly lower write performance

d. RAID level 5 a d. Improved read but poor write performance

5
11. (20 points) Given the Employee table, answer the following questions:

EmpID Dept Salary HireDate SupervisorID


1001 Finance 10000 01-Nov-98 1020
1002 Finance 15000 12-Dec-96 1020
1020 Finance 30000 09-Feb-93 1035
1015 Human Resources 20000 15-Mar-01 1045
1008 Operations 9000 22-Aug-97 1013
1010 Operations 12000 09-Jul-01 1013
1035 Operations 40000 14-Sep-95 1000
1007 Maintenance 5000 07-Oct-01 1017
1050 Human Resources 10000 05-Apr-98 1045
1000 Executive 60000 25-Nov-93
1016 Human Resources 11000 13-Oct-01 1045

Q1. Which employee ID would be returned in the output given the following query on the Employee table?

SELECT empID, dept, salary


FROM employee outer
WHERE salary > (SELECT min(salary)
FROM employee inner
WHERE inner.dept = outer.dept);

a. 1020, 1015, 1035, 1007, 1000


b. 1020, 1015, 1035
c. 1000
d. 1001, 1050, 1008, 1007, 1000
e. 1002, 1020, 1015, 1010, 1035,1016

Q2. Which statements will delete all employees from the Finance department who make less than $20,000
and hired during the year 2001?

a. DELETE FROM employee


WHERE dept = ‘Finance’
AND salary < 20000
AND hiredate BETWEEN ’01-jan-01’ AND ’31-dec-01’;

b. DELETE FROM employee


WHERE dept = ‘Finance’
AND salary < 20000
AND hiredate >= ’01-jan-01’ AND hiredate <= ’31-dec-01’;

c. DELETE FROM employee


dept = ‘Finance’
AND salary < 20000
AND hiredate >= ’01-jan-01’ AND hiredate <= ’31-dec-01’;

d. DELETE FROM employee


WHERE dept = ‘Finance’
AND salary < 20000
hiredate >= ’01-jan-01’ AND hiredate <= ’31-dec-01’;

6
Q3. Which answer best describes the following query?

SQL> SELECT empID, dept


2 FROM employee
* WHERE salary IS NOT NULL and ROWNUM<5;

a. Output will contain, empID and dept for any 5 employees who have salary data.
b. Output will contain, empID and dept for any all employees who have salary data.
c. Output will contain, empID and dept for any 5 employees who have no salary data.
d. Output will contain, empID and dept for any 4 employees who have salary data.
e. Output will contain, empID and dept for any 4 employees who have no salary data.

Q4. Which answer best describes the following query?

SQL> SELECT empID, dept


2 FROM employee
3* WHERE SupervisorID IS NULL and ROWNUM<2;

a. Output will contain, empID and dept for any 2 who have no SupervisorID data.
b. Output will contain, empID and dept for any employee who has no SupervisorID data.
c. Output will contain, empID and dept for any employee whose SupervisorID data is zero.
d. Output will contain, empID and dept for any 2 employees whose SupervisorID data is zero.
e. Output will contain, empID and dept for any 2 employees whose SupervisorID data IS NULL.

Q5. Which of the following statements will execute without errors?

a. SQL> CREATE TABLE employee_bonus (EmpID varchar(10) NOT NULL,


2 ProjID varchar(10) NOT NULL,
3 Start_Date date,
4 End_Date date,
5 Rating number(5,1),
6 Bonus number(10));

b. SQL> CREATE TABLE employee_bonus (EmpID varchar(10) NOT NULL,


2 ProjID varchar(10) NOT NULL,
3 Start_date date NULL,
4 End_Date date NULL,
5 Rating number(5,1) NULL,
6* Bonus number(10,2) NULL);

c. SQL> CREATE TABLE employee_bonus (EmpID varchar(10) NOT NULL,


2 ProjID varchar NOT NULL,
3 Start_date date ,
4 End_Date date ,
5 Rating number(5,1) ,
6* Bonus number(10,2) );

d. SQL> CREATE TABLE employee _bonus EmpID varchar(10) NOT NULL,


2 ProjID varchar(10) NOT NULL,
3 Start_date date ,
4 End_Date date ,
5 Rating number(5,1) ,
6* Bonus number(10,2) );

e. SQL> CREATE employee _bonus (EmpID varchar(10) NOT NULL,


2 ProjID varchar(10) NOT NULL,
3 Start_date date ,
4 End_Date date ,
5 Rating number(5,1) ,
6* Bonus number(10,2) );

7
Q6. Which of the following queries will select the name and average salary for all departments that satisfy
the following conditions:
- include all departments EXCEPT Human Resources
- average salaries greater than $10,000
- sort by department name
-

a. SQL> SELECT dept, avg(salary)


2 FROM employee
3 WHERE dept <> 'Human Resources'
4 GROUP BY dept
5* HAVING avg(salary)>10000;

b SQL> SELECT dept, avg(salary)


2 FROM employee
3 GROUP BY dept
4 WHERE dept <> 'Human Resources'
5* HAVING avg(salary)>10000;

c. SQL> SELECT dept, avg(salary)


2 FROM employee
3 WHERE dept <> 'Human Resources'
4 HAVING avg(salary)>10000
5* GROUP BY dept;

d. SQL> SELECT dept, avg(salary)


2 FROM employee
3 WHERE dept NOT EQUAL TO 'Human Resources'
4 GROUP BY dept
5* HAVING avg(salary)>10000;

Q7. Given the following SELECT statement,

SQL> SELECT * FROM emp_hr;

ID RATE
---------- ----------
101 10
102 20
103
104 10
105 20

What is the output of the following query? SELECT AVG(Rate) FROM emp_hr;

a. NULL
b. 12
c. 15
d. 10
e. 20

8
Q8. Given the following SELECT statement,

SQL> SELECT * FROM emp_hr;

ID RATE
---------- ----------
101 10
102 20
103
104 10
105 20

What is the output of the following query? SELECT AVG(NVL(Rate, 0))FROM emp_hr;

a. NULL
b. 12
c. 15
d. 10
e. 20

Q9. Which line of the following SELECT statement contains an error, if any?

SQL> SELECT EmpID, fname, lname, HireDate


2 FROM employee
3 WHERE lname = Jones, date_of_hire>’06-jan-02’
4 ORDER BY empID;

a. 1
b. 2
c. 3
d. 4
e. No error

Q10. Which of the following is not an aggregate function?

a. COUNT
b. AVG
c. TOTAL
d. SUM
e. MIN
f. MAX

Q11. What is the outcome of the following query?

SQL> SELECT EmpID, dept, salary


2 FROM employee
3* WHERE salary= ANY(30000,40000,50000)

Your Answer:

EmpID Dept salary


1020 Finance 30000
1035 Operations 40000

You might also like