Exam I Sample Questions

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Sample questions for Exam I

ITP 249

Multiple Choice
For each question fill in your answer in the blank provided next to the question number.

1. ___________ Which of the following may NOT be NULL in database tables?


a. Any attribute
b. Foreign keys
c. Indexes
d. Primary keys

2. ___________ Which of the following is true when normalizing a database table?


a. It decreases the number of anomalies in the database
b. It decreases the total number of database tables
c. It improves database performance
d. None of the above

3. ___________ Which of the following is true of a DBMS?


a. Data type of columns do not matter
b. Number of entities participating in a relationship does not matter
c. Order of rows and columns does not matter
d. Tables may not always have a primary key

4. ___________ An entity with a foreign key as part of its primary key can be described as having:
a. An index relationship
b. A strong relationship
c. A weak relationship
d. None of the above

1
Short Answer
Please fill in your answer to the following questions in the space provided.

5. What is the term for the attribute(s) that creates a relationship in between tables?

_____________________________Foreign key_______________________________________

6. Normalizing database tables decreases what?

__ Anomalies _or data redundancy_________________________________________

7. Given the functional dependency below, what is true of A?


AB

_____________________A functionally determines B, A is the determinant_________________

8. What must all entries of a database column conform to?

__ Same data type ___

Long Answer
Please fill in your answer to the following questions in the space provided.

9. What is a recursive or unary relationship? Give an example of one. Include an ERD of the
example

An entity can have a relationship with itself. This is a unary relationship


1:1 – Employee married to another employee
1:M – Employee manages other employees
M:N – Employee is friends with other employees

2
Normalization
10. Consider the dependency diagram

a. Show the table in 1NF.


b. Show the table decomposed into 2NF.
c. Show the table decomposed into 3NF.

a. Show the table in 1NF. Underlined attributes are PK. Italicized attributes are FK.
TABLE1(A, B, C, D, E, F, G)
b. Show the table decomposed into 2NF.
TABLE1(A, B, D, E, F)
TABLE2(B, C)
TABLE3(A, G)
c. Show the table decomposed into 3NF.
TABLE1(A, B, D, E)
TABLE2(B, C)
TABLE3(A, G)
TABLE4(D, F)

ER Diagram
11. Given the following database table listings, create an ERD.
CRS_COD CRS_DESC CRS_CREDITS
E CRS_TITLE
ACCT-211 Basic Accounting An introduction to accounting. Required of all business majors. 3
Database design and implementation issues. Uses CASE tools to 3
generate designs that are then implemented in a major database
CIS-380 Database Techniques 1 management system.
The second half of CIS-380. Basic Web database application 4
CIS-490 Database Techniques 2 development and management issues.

CRS_CODE SECT_NUM SECT_TIME SECT_PLACE


ACCT-211 1 8:00 a.m. – 9:30 a.m. T-Th. Business 325
ACCT-211 2 8:00 a.m. – 8:50 a.m. MWF Business 325
ACCT-211 3 8:00 a.m. – 8:50 a.m. MWF Business 402
CIS-490 1 1:00 p.m. – 3:00 p.m. MW Business 398
CIS-490 2 6:00 p.m. – 10:00 p.m. Th. Business 398

3
12. A laboratory has several chemists who work on one or more projects. Chemists also may use
certain kinds of equipment on each project. Attributes of CHEMIST include Employee ID
(identifier), Name, and Phone Number. Attributes of PROJECT include Project ID (identifier) and
Start Date. Attributes of EQUIPMENT include Serial Number and Cost. The organization wishes
to record Assigned Date – the date when a given equipment item was assigned to an individual
chemist working on a specified project. A chemist must be assigned to at least one project and
one equipment item. A given equipment item need not be assigned, and a given project need
not be assigned either a chemist nor an equipment item.

SQL
Morgan Importing purchases antiques and home furnishings in Asia and ships those items to a
warehouse facility in Los Angeles. Mr. Morgan uses a database to keep a list of items
purchased, shipments and shipment items. His database includes the following tables:

SHIPMENT (ShipmentID, ShipperName, ShipperInvoiceNumber, DepartureDate, ArrivalDate,


InsuredValue)
SHIPMENT_ITEM (ShipmentID, ShipmentItemID, ItemID, Quantity, Value)

4
ITEM (ItemID, Description, PurchaseDate, Store, City, Quantity, LocalCurrencyAmt,
ExchangeRate)

SHIPMENT Table

SHIPMENT_ITEM Table

ITEM Table

Name all calculated columns

13. List the ShipmentID, ShipperName, and ShipperInvoiceNumber for all shipments with an insured
value greater than 10000.

SELECT ShipmentID, ShipperName, ShipperInvoiceNumber

5
FROM SHIPMENT
WHERE InsuredValue > 10000;

14. List the ShipmentID, ShipperName, and ShipperInvoiceNumber of all shippers whose name starts
with “AB”.
SELECT ShipmentID, ShipperName, ShipperInvoiceNumber
FROM SHIPMENT
WHERE Shipper LIKE 'AB%';

15. Assume DepartureDate and ArrivalDate are in the format MM/DD/YY. List the ShipmentID,
ShipperName, and ShipperInvoiceNumber and ArrivalDate of all shipments that departed on the
10th of any month.
SELECT ShipmentID, ShipperName, ShipperInvoiceNumber, ArrivalDate
FROM SHIPMENT
WHERE DepartureDate LIKE '___10%'; (also accept ‘__10__’)

(accept both with / or without)

16. Determine the average InsuredValue.


SELECT AVG (InsuredValue) AS AvgInsuredValue
FROM SHIPMENT;

17. Count item purchases by City and Store.


SELECT City, Store, COUNT(*)
FROM ITEM
GROUP BY City, Store;

18. Count the number of shipments.


SELECT COUNT (*) AS NumberOfShipments or COUNT(ShipmentID)
FROM SHIPMENT;

You might also like