0% found this document useful (0 votes)
85 views20 pages

MIDTERM

1. The document provides instructions to create a circular linked list using invoice and product number data. 2. Questions are asked about developing relational algebra and calculus solutions to queries on tables for customers, orders, and salespeople. 3. The final questions relate to a tree structure and database management exam concepts.

Uploaded by

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

MIDTERM

1. The document provides instructions to create a circular linked list using invoice and product number data. 2. Questions are asked about developing relational algebra and calculus solutions to queries on tables for customers, orders, and salespeople. 3. The final questions relate to a tree structure and database management exam concepts.

Uploaded by

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

DATABASE MANAGEMENT

Midterm Exam

1. Create a Circular Linked List on ProductNum. using the following data.

InvoiceNum ProductNum
456352 16110
736378 20114
637368 16110
373743 16110
386383 14001
745745 14001
456473 16051
235677 16051
123465 16110
456457 02104
785674 02105
356463 02104
234546 14001
756757 20114

6. Using the the following Invoice Numbers and item numbers, item numbers are the secondary key, construct a
Circular Linked List with pointers for Item Number.

Item number Head Pointer:

Invoice Number Item Number Pointer Relative Rec. No.


1234 345 1
2453 456 2
5643 567 3
5737 345 4
6799 345 5
7567 567 6
8568 456 7
8569 567 8
9064 987 9
Use the following relational schema to develop relational algebra and relational calculus solutions for
each of the following queries.

CUSTOMER(CUST_ID, CUST_NAME, CITY, PHONE)

ORDER(ORD_NO, CUST_ID, VENDOR, SALEPNAME, AMOUNT)

SALEPERSON(SALEPNAME, AGE, SALARY)

2. What are the names of salespeople having an order with Vendor, Lewis Construction?

3. What are the city of all Customers having an order with salesperson Jones?

4. What are the ages of sales people having an order with Vendor, Manchester Lumber?

5. Given the following attributes, define a table using the proper notation and include the key.

STDNUM - Student Number


STDNAME - Student Name
STDADDR - Student Address
BALANCE - Student Tution Balance
GPA - Grade Point Average

6. Using the same data from the above question, create a Multi List with ProductNum as the
secondary key.

InvoiceNum ProductNum
456352 16110
736378 20114
637368 16110
373743 16110
386383 14001
745745 14001
456473 16051
235677 16051
123465 16110
456457 02104
785674 02105
356463 02104
234546 14001
756757 20114

Use the following tree structure to answer the following seven questions.

TREE:
A
----------------- --------------
| |
B C
-------- ------- -------- -------
| | | |
D E F G

7. List the letter(s) of the root node.

8. List the letter(s) of the children nodes.

9. List the letter(s) of the parent nodes.

10. List the ancestors of node F.

11. List the twins of node C.

12. What is the order of the tree?

13. What is the depth of the level that contains the B and C nodes?

14. If you have a tree with an order of 5, how many keys can each node contain?

15. If you have a tree with an order of 9, how many keys will be stored in the entire tree at a
maximum?

16. The following is an ER Model for a law firm. You need to convert the ER Model to a Structured
Entity Chart.

DATABASE MANAGEMENT
Midterm Exam
Multiple Choice 1 point each

1. A technique used to organize the findings of the conceptual design team is called:
a. a relationship model
b. a relationship-design model
c. a entity-relationship model

2. During what phase of the entity consolidation is the semantic synonyms recognized?
a. Aggregation
b. Generalization
c. Identification

3. The weakness in a database management system that may occur when two processes are trying
to access the same record is called:
a. Locking
b. Dead lock
c. two-phase locking

4. Three commonly used data models are:


a. Network, Relational, and Menu driven
b. Network, Relational, and Hierarchical
c. Relational, Hierarchical, and Menu driven
d. Relational, Hierarchical, and File Managers

5. Which of the following is not an advantage of the DBMS approach?


a. Reduce data redundancy
b. Reduce programming effort
c. Faster response time
d. Data dependency

6. Two major functional components of a DBMS are:


a. Data Definition Language and Subschema
b. Data Definition Language and Schema
c. Subschema and Schema
d. Data Definition Language and Data Manipulation Language

7. Which of the following is used to define the location, length, and format of the data elements, the
position of each element within the data structure, and the security of each data element?
a. View
b. Schema
c. Subschema
d. Data Manipulation Language

7. Which of the following is used to define the location, length, and format of the data elements, the
position of each element within the data structure, and the security of each data element?
a. Data Definition Language
b. Schema
c. Subschema
d. Data Manipulation Language

8. Which of the following is a set of commands to cause data to be stored and retrieved by a DBMS?
a. Data Definition Language
b. Schema
c. Subschema
d. Data Manipulation Language

9. Which of the following describes the logical view of the data?


a. Data Definition Language
b. Schema
c. Subschema
d. Data Manipulation Language

10. Which of the following describes the application program view of the data?
a. Data Definition Language
b. Schema
c. Subschema
d. Data Manipulation Language

11. Which of the following limits the functions that the program or user can perform?
a.Data Definition Language
b.Schema
c.Subschema
d.Data Manipulation Language

12. A logical transaction is:


a. The collection of all updates of a given record.
b. An update of a single record in the database.
c. A collection of updates in which all must be accomplished or none must be accomplished.
d. A collection of updates from various users being made concurrently.
13. The lock level that will create the least contention among users is:
a. The database level.
b. The page level.
c. The record level.
d. The field level.

14. To recover the database from a transaction discovered to be erroneous one week after it had
been entered:
a. Apply before images of the transaction to the database.
b. Apply after images of the transaction to the database.
c. Use a differential file.
d. Enter an offsetting transaction.

15. The simplest way to recover the database from the failure of a single transaction is to:
a. Apply all after images of the transaction to the database.
b. Apply all before images of the transaction to the database.
c. Begin with the most recent copy of the database and apply all before images in the log.
d. Begin with the most recent copy of the database and apply all after images in the log.

16. Which of the following is not an example of an integrity constraint;


a. Customer numbers must be numeric.
b. The payroll office may not delete customers.
c. Customers whose balance is not zero may not be deleted.
d. The sales rep for customers in the database must also be in the database.

17. Ideally, locks should be released:


a. At the end of the day.
b. After any update is made to the database.
c. Only after all the updates for a transaction have been completed.
d. Once every five or ten minutes.

18. If a user wishes to guarantee that no other users will have access to the data while (s)he is
modifying a database, (s)he would utilize:
a. exclusive access
b. read-only access
c. read/write access
d. password access
e. none of the above

Fill-In-The-Blank:

1. The DBMS acts as an interface between the _______________________ and the

_________________________. 2 points

2. The terms relation, tuple, and attribute correspond to table, ________________, and
______________ respectively. 2 points

3. The three tables that we talked about that make-up the catalog are

_______________________, ___________________, and ___________________. 3 points

4. For most situations, tables in _______ normal form are usually free from the problems of data
redundancy and abnormalities. 1 point

5. Current efforts in data base design are divided into 3 separate steps: development of the

_____________________, ________________________, _______________________


respectfully. 3 points

Short Problems:

1. List the 10 Functions of a DataBase Management System. 10 points

2. Given the following attributes, define a table using the proper notation and include the key.
10 points

ORD# - Order Number


ODATE - Date of Order
CUSTNO - Customer Number
PAYMENT - Payment included
ORDTOT - Total Cost of Order
PRODNO - Product Number
QTYORD - Quantity Ordered

Using the table that was defined in the above problem, answer the following questions.

3. What are the functional dependencies that exist in this table? If any, state the dependency and list
the dependency type for each. 10 points

4. What is the normal form of the table? 10 points

5. If the table is not in third normal form, translate the table into third normal form. Use proper table
notation. 10 points
6. Using the following log, assume that the DBMS being used issues locks whenever a READ,
MODIFY, INSERT, or ERASE command is given and releases all locks held by a transaction when a
COMMIT command is executed. Locks occur at the record level. Determine the locks held by each
transaction at each point throughout the session. 15 points

Tans ID Time Action Record affected Locks held


Rent01 10:00 Start
Rent01 10:01 Read Video(509) Video(509)
Cust01 10:02 Start Video(509)
Cust01 10:03 Insert Customer(1245) Video(509), Customer(1245)
Rent01 10:04 Modify Video(509) Video(509), Customer(1245)
Rent01 10:05 Read Customer(2334) Video(509), Customer(1245),
Customer(2334)
Cust01 10:06 Commit Video(509), Customer(2334)
Rent01 10:07 Modify Customer(2334) Video(509), Customer(2334)
Rent01 10:08 Commit

Use the following relational schema to develop relational algebra and relational calculus solutions for
each of the following queries.

CUSTOMER(CUST_ID, CUST_NAME, ANNUAL_REVENUE)


SHIPMENT(SHIPMENT_#, CUST_ID, WEIGHT, TRUCK_#, DESTINATION)
Foreign Key: DESTINATION References CITY
TRUCK(TRUCK_#, DRIVER_NAME)
CITY(CITY_NAME, POPULATION)

5. What are the cities with population under 100,000 and what are their populations?
10 points
Relational Algebra:
A:= Select(City: Population < 100,000)
B:= A[CityName, Population]

Relational Calculus:
{r.city-name, r.population: r IN city and r.population < 100,000}
6. What are the weights of shipments sent by customers with over $1 million in annual revenue?
10 points
Relational Algebra:
A:= Select(Customer: Annual-revenue > 1,000,000)
B:= Join(A, Shipment)
C:= B[Weight]

Relational Calculus:
{r.weight: r IN Shipment and there exists t IN Customer(r.cust_Id = t.cust_Id and Annual-revenue >
1,000,000}
Short Problems:

1. List and briefly describe each of the six steps in the database development life cycle. 7 points

2.What is meant by two-phase locking? 7 points

3. What is deadlock? 7 points

4. If deadlock occurs, why must one transaction be rolled back instead of merely held up and allowed
to continue when the other user is done? 7 points

5. What is the difference between a shared lock and an exclusive lock? 7 points

6. What is meant by lock granularity? 7 points

7. Why is data independence a big advantage in a DBMS? 7 points

8. Why is data redundancy a big problem in DBMS? 7 points

9. What is the difference between the schema and the subschema of a database? 7 points

10. Define the purpose of conceptual design? 7 points

11. What are the 2 major functional components of a database management system and what are
the purpose of each of these components? 7 points

12. Given the following attributes, define a table using the proper notation and include the key.
7 points

CUST# - Customer Number (Key)


CUSTNAME - Customer Name
CUSTADD - Customer Address
BALANCE - Customer Balance

13. Determine the multivalued dependencies in the following relation. 7 points

COURSE(CRSENUMB, TEXTBOOK, INSTNUMB)

14. Using your knowledge of a college environment, determine the functional dependencies that exist
in the following relation. After these have been determined, convert this relation to an equivalent
collection of relations that are in 3rd normal form. 9 points

STUDENT(STUNUMB, STUNAME, NUMBCRED, ADVNUMB, ADVNAME, DEPTNUMB,


DEPTNAME, CRSENUMB, CRSEDESC, CRSETERM, GRADE)

2. The DBMS acts as an interface between what two parts of a system? 2 points

3. List the three tables that we talked about that make-up the catalog. 3 points

11. For most situations, tables in _______ normal form are usually free from the problems of data
redundancy and abnormalities. 5 points

12. A conceptual design for CSU's application is given below:

STUDENT (student_id, lname, fname, mi, major, gpa, advisor_id)

TEACHER (teacher_id, lname, fname, mi, department_id)

CLASS (class_id, name, section, days, hour, room_id, teacher_id, capacity, enrolled)

ENROLL (student_id, class_id)

ROOM (room_id, building, seats)

Using the conceptual design from above, draw an entity relationship model for a teacher-oriented
relational system. Show only the entities, not the attributes and the relatiionship between the entities.
10 points

8. Using the conceptual design from the previous problem, draw a Semantic Object Model for a
teacher-oriented relational system.

Note: I will use DBMS in this exam to mean Data Base Management System.

1. Contrast file-processing systems and database processing systems.

4. What is the schema of a database and what is its purpose?


9. Given the following attributes, define a table using the proper notation and include
the key.

CUSTNUMB - Customer Number


CUSTNAME - Customer Name
CUSTADDR - Customer Address
BALANCE - Customer Balance
CREDLIM - Customer Credit Limit
SLSRNUMB - Sales Representative Number

Using the following table, answer the following questions.

ORDLNE[ORDNUMB, PARTNUMB, NUMBORD, QUOTPRCE]

10. What are the functional dependencies that exist in this table? If any, state the
dependency and list the dependency type for each.

11. What is the normal form of the table?

12. If the table is not in third normal form, translate the table into third normal form. Use
proper table notation.

13. Briefly explain how a file that will allow random access to the data uses indexes to
accomplish this task.

14. Create a doubly linked list on CourseNum. using the following data.

StudentNum CourseNum
456352 16110
736378 20114
637368 16110
373743 16110
386383 14001
745745 14001
456473 16051
235677 16051
123465 16110
456457 02104
785674 02105
356463 02104
234546 14001
756757 20114

Note: I will use DBMS in this exam to mean Data Base Management System.
1. Contrast file-processing systems and database processing systems.

2. Why is data redundancy a big problem in DBMS? List at least 3 situations that
redundant data could compromise the integrity of the data

3. Name the two major functional components of a database system, and briefly explain
the function of each.

4. One of the major functional components of a database system, from the above
question, is broken down into 2 subfunctions. Which is the function that is subdivided
further and what are the 2 subfunctions?

5. Briefly define the purpose of the 2 subfunctions from the above problem.

8. Create a Inverted file on CourseNum. using the following data.

StudentNum CourseNum
456352 16110
736378 20114
637368 16110
373743 16110
386383 14001
745745 14001
456473 16051
235677 16051
123465 16110
456457 02104
785674 02105
356463 02104
234546 14001
756757 20114

9. Using the same data from the above question, create a Circular Linked List with
CourseNum as the secondary key.

Use the following relational schema to develop relational algebra and relational calculus
solutions for each of the following queries.

CUSTOMER(CUST_NAME, CITY, INDUSTRY_TYPE)


ORDER(ORD_NO, CUST_NAME, SALEPNAME, AMOUNT)
SALEPERSON(SALEPNAME, AGE, SALARY)

17. What are the names of salespeople having an order with Abernathy Construction?

18. What are the city of all Customers having an order with salesperson Jones?

19. What are the ages of sales people having an order with Manchester Lumber?

20. What are the names of all salespeople with the names of customers who have
ordered from them?

1. List two different file organizations.

2. What type of accesses can be done with each of the above file organizations? Include all
access modes.

3. Using the following formula, determine the relative record number for each of the following
records.

Formula: Invoice Number * 2 + 3

Invoice No. Relative Record Number


1234

2543

7645

6845

3457

1546

2467
4556

4. Did the hashing method used in number 3 cause a collision to occur?


5. List three methods of collision resolution.
14. List five functions of a DataBase Management System.

15. Define DataBase Management System.

16. What are three advantages of using a DataBase Management System?

17. Define Deadlock.

18. Explain Two-phase locking.

19. List the three steps in the development of a database design.

20.One aid that is used to map attributes into records is an _______________________.

21. List two methods that could be use in the data collection of the design phase.

22. What is the advantage of involving everyone in the design phase of the DataBasee
Management System?

23. Briefly describe the Intuitive Database Design method.

24. What is the purpose of the Entity-Relationship design model?

25. What advantage is there in formally designing a database management system?


Use the following choices as possible answers to questions 9 thru 22.

a. DBA Administrative Functions


b. DBA Application Functions
c. DBA Technical Functions

9. Database Design
10. Enterprise Planning
11. Standards and Procedures
12. DBMS Evaluation and Selection
13. Policy Formulation
14. Data Dictionary Management
15. Test/Production Environments
16. Training
17. Top-level Education and Commitment
18. Overall Coordination
19. Database Loading
20. DBMS Support
21. Keep Current with Technology
22. Complications to DBMS Processing
Link list use pointers or links to maintain the logical sequence of the records, instead of physically rearranging
the entire file. Listed below are 10 software names. Using the links listed on the right, place the software in
logical alphabetic order.

23. DBase III a. 0


24. Lotus 1-2-3 b. 1
25. Excel c. 2
26. Word d. 3
27. Wordperfect e. 4
28. Print Shop ab. 5
29. Free space added to the database ac. 6
30. SQL ad. 7
31. C Compiler ae. 8
32. AS/400 Tutorial bc. 9
bd. 10
33. What value does FIRST hold? de. 11

Short Answer:

34. A __________________ tree is one in which the height of each node's subtrees differs by at most 1.

35. If we have a B-tree of order 9, the number of keys that can be stored in each node is _________________.

36. A __________________ is a memory area holding one or more blocks of data.

37. The grouping of records based on usage patterns is called ______________.

38. Alternative names for a physical record are page and ____________.
39. A randomizing routine is another name for a __________________ function.

40. The use of a _________________ technique for direct organization results in a unique disk address.

41. Construct a Circular linked list with pointers for the following records: 100, 50, 40, 200, 300, 150, 50, 40,
50, 100, 200, 200, 300
42. Breifly explain the difference between Distributed Database and Distributed processing.

This workforce solution is funded in part by the IHUM Consortium which is 100% financed through a $15,000,000 grant from the U.S.
Department of Labor’s Employment and Training Administration.

The product was created by the grantee and does not necessarily reflect the official position of the U.S. Department of Labor. The Department of
Labor makes no guarantees, warranties, or assurances of any kind, express or implied, with respect to such information, including any
information on linked sites and including, but not limited to, accuracy of the information or its completeness, timeliness, usefulness, adequacy,
continued availability, or ownership.

This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit
http://creativecommons.org/licenses/by/4.0/.

You might also like