CSCE 4523 Introduction To Database Management Systems
CSCE 4523 Introduction To Database Management Systems
Fall 2016
Signature
Attempt all of the following questions. The test consists of 21 multiple choice/fill in
the blank questions. For multiple choice questions, indicate which you consider
the single most appropriate answer. Indicate your selection circling your selection.
For fill in the blank questions, provide the missing word or fill in the letter for the
most appropriate option, when options are given.
The exam questions total 32 points and the exam will be graded out of 29, so there
are 3 bonus points built in.
If you have any questions about the questions, write your assumptions in the margin and
answer the question as you understand it.
1
1. Which is not an advantage of a DBMS over file-based systems:
a. Control of data redundancy
b. Improved data consistency
c. Improved performance. ANSWER
d. Improved security.
e. Easier data sharing
2. In the ANSI/SPARC three level database model, the external view is best described
by which one of the following options:
a. It is dependent on the underlying DBMS product used (e.g. Oracle, MySql).
b. It is the place where the users interface to the DBMS. ANSWER
c. It is the place where the storage structures link to the database.
d. It is not part of the model.
e. None of the above.
2
5. A database includes two relations Student and Program
Student Program
Matric_No F_Name L_Name Prog_Code Prog_Code P_Name
04009991 Alicia Smith 0001 0001 Computing
04009992 Alan Smith 0002 0002 Soft. Eng.
04009993 John Bush 0003
The result of the Cartesian product of Student and Program (i.e., Student X Program) is:
a. Matric_No F_Name L_Name Prog_Code P_Name
04009991 Alicia Smith 0001 Computing
04009992 Alan Smith 0002 Soft. Eng.
04009993 John Bush 0003 NULL
b. Matric_No F_Name L_Name Prog_Code Prog_Code P_Name
04009991 Alicia Smith 0001 0001 Computing
04009991 Alicia Smith 0001 0002 Soft. Eng.
04009992 Alan Smith 0002 0001 Computing
04009992 Alan Smith 0002 0002 Soft. Eng.
04009993 John Bush 0003 NULL NULL
04009993 John Bush 0003 NULL NULL
c. Matric_No F_Name L_Name Prog_Code P_Name
04009991 Alicia Smith 0001 Computing
04009992 Alan Smith 0002 Soft. Eng.
d. ANSWER Matric_No F_Name L_Name Prog_Code Prog_Code P_Name
04009991 Alicia Smith 0001 0001 Computing
04009991 Alicia Smith 0001 0002 Soft. Eng.
04009992 Alan Smith 0002 0001 Computing
04009992 Alan Smith 0002 0002 Soft. Eng.
04009993 John Bush 0003 0001 Computing
04009993 John Bush 0003 0002 Soft. Eng.
e. None of the above
3
6. Given the same relations and result options as in question 5, which would be the result
7. Given the same relations and result options as in question 5, which would be the result
of left outer join of Student and Program (i.e., Student Program)?
a. ANSWER
b.
c.
d.
e.
4
11. π is the projection operator. σ is the selection operator. R is a relation. Select
the relational expression that could possibly return the following result:
ac
12
23
14. In order to use a join two relations on attributes that have the same values but
different names in the two tables (e.g., hotelID in relation1 and hotelNum in relation2),
we need to use
a. Theta Join
b. Equijoin ANSWER
c. Natural join
d. Outer Join
e. Inner Join
5
15. Given a database:
Customer(Cust_no, Name, Address)
Order(Order_no, Cust_no, C_Date, Completed)
Make(Order_no, Maker_no, Dress_style, Colour)
Identify the SQL command which will most likely return the date of all orders that have
completed and are made of Red or Blue coloured materials.
a. SELECT Date
FROM order,Make
WHERE completed = 'Y'
AND (colour = 'Red' OR colour = 'Blue')
b. SELECT C_Date ANSWER
FROM order,Make
WHERE Order.Order_no = Make.Order_no
AND completed = 'Y'
AND colour = 'Red'
OR colour = 'Blue'
c. SELECT C_Date
FROM order,Make
WHERE Order.Order_no = Make.Order_no
AND completed = 'Y'
AND colour = 'Red' OR 'Blue'
d. SELECT Date
FROM order,Make
WHERE completed = 'Y'
AND colour = 'Red'
OR colour = 'Blue'
e. SELECT Date
FROM order,Make
WHERE Order.Order_no = Make.Order_no
AND completed = 'Y'
AND (colour = 'Red'
OR colour = 'Blue')
6
16. Consider the schema in Question 15. Write the letter for the matching type of key
on the lines provide beside each example. Use each letter exactly once.
17. A database includes two relations Student and Program (NOTE: Different tuples
than in 5.)
S P
Matric_No F_Name L_Name Prog_Code Prog_Code P_Name
04009991 Alicia Smith 0001 0001 Computing
04009992 Alan Smith 0002 0002 Soft. Eng.
04009995 Alicia Bush 0001
04009995 John Smith 0001
Select the relational expression that could possibly return the following result:
F_Name L_Name P_Name
Alicia Smith Computing
John Smith Computing
a. πF_Name,L_Name,P_Name
(πL_Name=’Smith’ANDP_Name=’Computing’ S ) P)
b. πF_Name,L_Name,P_Name
(σL_Name=’Smith’ (S P))
c. πF_Name,L_Name,P_Name
(σL_Name=’Smith’ANDP_Name=’Computing’ (S P)) ANSWER
d. σF_Name,L_Name,P_Name
(πL_Name=’Smith’ANDP_Name=’Computing’ (S P))
e. None of the above
7
18. Give the tables in Question 17, fill in the missing pieces of the following SQL query
so that it would generate the table below:
Program Sum
Soft. Eng. 1
Computing 3
FROM S, P
19. Consider the tables in Question 17. When we created table S we used the following
SQL snippet:
If we try to delete the tuple with Prog_Code=0001 from P, write the letter for the action
that the DBMS should take for each <constraint> on the lines provided. Use each letter
exactly once:
20. When implementing a sorted file-based solution to storing and accessing data,
which is the least efficient method to handling the addition of additional records
a. Placing extra empty records throughout the file to hold insertions
b. Using an overflow file for inserted records
c. Re-sorting the file after every insertion ANSWER
d. Appending inserted records to the end of the sorted records
8
9