0% found this document useful (0 votes)
25 views

Introduction To Databases Test

afafa

Uploaded by

newarsahil34
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Introduction To Databases Test

afafa

Uploaded by

newarsahil34
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

lOMoARcPSD|43575198

INTRODUCTION-TO-DATABASES-CT042-3-1-IDB Practice
Mock All Chapters 1-12
Introduction To Databases (Asia Pacific University of Technology and Innovation)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by Amt 007 (amtgameplay@gmail.com)
lOMoARcPSD|43575198

MOCK EXAM – ANSWER (IDB 032024)

1. A term attribute refers to a __________ of a table


a. Record
b. Primary Key
c. Foreign Key
d. Field

2. In the System Development Life Cycle (SDLC), problems defined during the planning
phase are examined in greater detail during the analysis phase.
Answer: True/FALSE

3. Foreign key is
a. A field in the table that is foreign key in another table.
b. A field in the table that is primary key in another table.
c. A field in the table that is record key in another table.
d. A field in the table that is column key in another table

4. _____ is one reason for problems of data integrity.


a. Data redundancy
b. Security constraints
c. Data inconsistency
d. Data availability constraints

5. A database management system


i. Allows simultaneous access to multiple files
ii. Can do more than a record management system
iii. Is a collection of programs for managing data into a single file

a. i, ii
b. i, ii, iii
c. i, iii
d. ii, iii

6. ROLLBACK in a database is ________ statement.


a. DDL
b. DML

Downloaded by Amt 007 (amtgameplay@gmail.com)


lOMoARcPSD|43575198

c. DCL
d. CML

7. Which of the following statements fully describes data in 2NF


a. When any repeating fields have been removed and the table is given primary
key.
b. When all the fields in each table are directly related to the primary key.
c. When all repeating entries of data are removed and the fields in each table
are directly related to the primary key and no fields are present that are not
related to each other.
d. None of the mentioned.

8. Data normalisation is enforced by the DBMS through a proper use of primary and
foreign key rules.
Answer: True/ False

9.
Which characteristic points to the tables shown above being in third normal form
(3NF)
a. The tables are completely free of data redundancy
b. The attributes are all single valued
c. “ClientID” appears in more than one table.
d. Each primary key has a functional dependency on every other primary key in
the table

Downloaded by Amt 007 (amtgameplay@gmail.com)


lOMoARcPSD|43575198

10. The primary objective in database design is to create complete, normalized,


nonredundant and fully integrated conceptual, logical, and physical database
models.
Answer: True/FALSE

11. What is atomic field


a. A field that contains multiple items of data
b. A field that contains only one item of data
c. A field that is repeated
d. A field that contains is not repeated

12.
Table: salesman

Based on above table, answer the following questions:

a. Write a SQL statement that displays all the information about all salespeople. (2
marks)

SELECT * FROM salesman;

b. Write a SQL statement to display specific columns such as names and


commissions for all salespeople. (3 marks)

SELECT name, commission FROM salesman;

Downloaded by Amt 007 (amtgameplay@gmail.com)


lOMoARcPSD|43575198

13.
Table: Order

Based on above table, answer the following questions:

a. From the following table, write a SQL query to identify the unique salespeople ID.
Return salesman_id. (3 marks)

SELECT DISTINCT salesman_id FROM order;

b. From the following table, write a SQL query to find orders that are delivered by a
salesperson with ID. 5001. Return ord_no, ord_date, purch_amt. (3 marks)

SELECT ord_no, ord_date, purch_amt FROM order WHERE salesman_id=5001;

14. Based on case study below, draw a complete Entity Relationship Diagram (ERD).
You can choose either Chen or Crow Foot Notation. (15 marks)

Downloaded by Amt 007 (amtgameplay@gmail.com)


lOMoARcPSD|43575198

Answer **All relevant answers are accepted.

Downloaded by Amt 007 (amtgameplay@gmail.com)


lOMoARcPSD|43575198

15.

Based on the relations above, write structured query language (SQL) for the queries
given below. (12 marks)

a. List all male staff who earn below 4000 from ‘Marketing’ department (3
marks)

Select S.* from Staff S


Inner join Department D on S.dept_ID=D.dept_ID
where S.monthlysalary < 4000 and S.gender=’Male’ and D.name=’Marketing’

b. Add new department named Sales (D04), phone extension is 5014. (3 marks)

Insert into Department Values(‘D04’,’Sales’,5014)

c. Staff named Ricky has changed address from Johor Bharu to Sri Petaling,
make necessary changes. (3 marks)

Update Staff set Address=’Sri Petaling’ where name=’Ricky’

d. Staff named Eugene had resigned from the company, delete his record (3
marks)

Delete Staff where name=’Eugene’

16. Given the UNF below, normalized to 3NF. (20 marks)

Downloaded by Amt 007 (amtgameplay@gmail.com)


lOMoARcPSD|43575198

Downloaded by Amt 007 (amtgameplay@gmail.com)


lOMoARcPSD|43575198

Answer:

UNF
OrderN Unit Price Quantity Amount TotalAmo Cust_ ClerkI
um Description (RM) (pcs) (RM) unt ID CustName Address SO Date D ClerkName
Fairy Tales FutureKids Bukit Jalil, Kuala 25/10/2 Martin
B01 Stories 45 3 135 208 C005 Kindergarten Lumpur A112 023 003 Lawrence
FutureKids Bukit Jalil, Kuala 26/10/2 Martin
B06 The Mermaid 28 1 28 208 C005 Kindergarten Lumpur A113 023 003 Lawrence
The Red Riding FutureKids Bukit Jalil, Kuala 27/10/2 Martin
B12 Hood 15 3 45 208 C005 Kindergarten Lumpur A114 023 003 Lawrence

1NF
Primary Key: SO + OrderNum

Full Dependencies:
SO,ORderNumber -> Quantity, Amount

Partial Dependencies:
SO -> TotalAmount,Cust_ID,CustName,Address,Date,ClerkID,ClerkName
OrderNumber -> Description, unitPrice

Transitive Dependencies:
Cust_ID -> CustName, Address
ClerkID -> ClerkName

2NF

Downloaded by Amt 007 (amtgameplay@gmail.com)


lOMoARcPSD|43575198

SALES_ORDER_ITEM (SO,ORderNumber -> Quantity, Amount)

SALES_ORDER (SO ->


TotalAmount,Cust_ID,CustName,Address,Date,ClerkID,ClerkName)

ITEM (OrderNumber -> Description, unitPrice)

Transitive Dependencies:
Cust_ID -> CustName, Address
ClerkID -> ClerkName

3NF
SALES_ORDER_ITEM (SO,ORderNumber -> Quantity, Amount)

SALES_ORDER (SO -> TotalAmount,Cust_ID,Date,ClerkID)

ITEM (OrderNumber -> Description, unitPrice)

CUSTOMER(Cust_ID -> CustName, Address)

CLERK (ClerkID -> ClerkName)

Downloaded by Amt 007 (amtgameplay@gmail.com)


lOMoARcPSD|43575198

17. A General Hospital consists of a number of specialized wards (such as Radiology,


Oncology, etc) .Information about ward includes unique name, total numbers of
current patients. Each ward hosts a number of patients, who were admitted by a
consultant (doctors) employed by the Hospital. On admission, the date and time are
kept. The personal details of every patient includes name, Medical Recode Number
(MRN), set of phone and one address (city, street, code).

A separate register is to be held to store the information of the tests undertaken.


Each test has unique episode No. , category and the final result of test. Number of
tests may be conducted for each patient. Doctors are specialists in a specific ward
and may be leading consultants for a number of patients. Each patient is assigned to
one leading consultant but may be examined by other doctors, if required.

Draw an Entity Relationship Diagram (ERD) to represent the data requirements as


following:

a. Identify the main entity types.


b. Identify the main relationship types between the entity types.
c. Identify attributes and associate them with entity or relationship types.
d. Determine candidate and primary key attributes for each (strong) entity type.
e. Determine the multiplicity constraints for each relationship .State any
assumptions necessary to support your design.

You may choose to use Chen Notation or Crow Foot Notation (20 marks)

Answer **All relevant answers are accepted.

Downloaded by Amt 007 (amtgameplay@gmail.com)


lOMoARcPSD|43575198

Downloaded by Amt 007 (amtgameplay@gmail.com)

You might also like