answer scheme

advertisement
MIDTERM EXAMINATION
JANUARY 2013 MIDTERM EXAMINATION
1/13/34 ACADEMIC SESSION
COURSE
COURSE CODE
DURATION
FACULTY
PROGRAMME
LECTURER
:
:
:
:
DATABASE SYSTEM/INTRODUCTION TO DATABSE
IAS 2143/IXS2253
3 HOURS
COMPUTER SCIENCE AND INFORMATION
TECHNOLOGY
: BACHELOR OF SCIENCE IN INFORMATION
TECHNOLOGY (HONS)
BACHELOR OF COMPUTER SCIENCE (SOFTWARE
ENGINEERING) (HONS)
BACHELOR OF COMPUTER SCIENCE (HONS)
BACHELOR OF INFORMATION TECHNOLOGY
(KNOWLEDGE MANAGEMENT) (HONS)
BACHELOR OF MULTIMEDIA INDUSTRY(HONS)
BACHELOR OF SCIENCE IN IT WITH SUPPLY
CHAIN MANAGEMENT(HONS)
BACHELOR OF BIOINFORMATICS (HONS)
: MR AZHAR HAMID
INSTRUCTIONS TO CANDIDATES
ANSWER SCHEME
This paper consists of (3) sections:
Section A – 15 questions (multichoice)
Section B – 3 questions (structured)
Section C – 2 questions (essay)
All answers of:
Answer all questions in Section A, B and C. All questions must be answered in the
spaces provided. Candidates are NOT ALLOWED to bring any unauthorized items
into the exam hall except with the permission of your invigilator.
Do Not Open the Question Paper Until Instructed
This Question Paper Consists of Seven (7) Printed Pages
CONFIDENTIAL
FCSIT/IAS2143/IXS2253/JUL12
SECTION A (15 Marks)
Answer ALL the questions. For each question circle the correct answer.
1.
Which of the following statements is NOT the definition of a database?
A.
B.
C.
D.
2.
The ANSI-SPARC three-level architecture is external, conceptual and internal levels. Which of
the following statements describe the conceptual level?
A.
B.
C.
D.
3.
4.
Shared collection of logically related data (and a description of this data), designed to
meet the information needs of an organization.
System catalog (metadata) provides description of data to enable program–data
independence.
Logically related data comprises entities, attributes, and relationships of an
organization’s information.
Collection of application programs that perform services for the end users specific
to their department requirements.
The user’s view of the database that describes part of database that is relevant to
each user.
The community view of the database that describes what data is stored in the database
and the relationships among the data.
The physical representation of the database on the computer that describes how the data
is stored in the database.
The organization’s view of the database that describe the requirements for the database.
The main THREE (3) disadvantages of file-server architecture are
i.
ii.
iii.
iv.
large amount of network traffic
full copy of the DBMS is required o each workstation
concurrency, recovery ad integrity control are more complex
strong data independence
A.
B.
i,ii
i,iii,iv
Table
Tuple
Booby trap
Entity trap
C.
D.
Attribute
None of the above.
Which of the following term is an alternative terminology for a tuple?
A. Attribute
B. Entity
7.
C.
D.
Which of the following term is an alternative terminology for a relation?
A.
B.
6.
i,ii,iii
ii, iii, iv
___________ is where a model suggests the existence of a relationship between entity types
but the pathway does not exist between certain entity occurrences.
A. Fan trap
B. Chasm trap
5.
C.
D.
C.
D.
Row
Properties
Which of the following is the statement that describes a referential integrity?
A. A constraint that states that in a base relation no attribute of a primary key can be null.
B. Foreign key values must match a candidate key value of some tuple in the home
relation or be wholly null.
C. A constraint that states that in a base relation there must be a primary key.
D. Foreign key values must match a non-key value of some tuple in the home relation or be
wholly null.
CONFIDENTIAL/2
FCSIT/IAS2143/IXS2253/JUL12
STUDENT
SUBJECT
Register
Figure 1
8.
What is the cardinality or multiplicity of the entity relationship in Figure 1?
A. One-to-one
B. Many-to-one
C.
D.
Employee
One-to-many
Many-to-many
Branch
Manage
Figure 2
9.
What is the cardinality or multiplicity of the entity relationship in Figure 2?
A.
B.
10.
One-to-many
Many-to-many
a foreign key
a main form and a sub form
C.
D.
a query and its associated dynaset
a primary key
Database error also known as ________________.
A.
B.
12.
C.
D.
Tables are related to one another through ________________.
A.
B.
11.
One-to-one
Many-to-one
database redundancy
database limitation
C.
D.
database weakness
database anomalies
Which of the following statements describe on multi-valued attributes?
A.
B.
C.
D.
Attribute that holds a single value for each occurrence of an entity type.
Attribute that holds multiple values for each occurrence of an entity type.
Attribute that represents a value that is derivable from value of a related attribute, or
set of attributes, not necessarily in the same entity type.
Attribute composed of multiple components, each with an independent existence.
CONFIDENTIAL/3
FCSIT/IAS2143/IXS2253/JUL12
13.
Which of the following SQL statements that will display the number of student in a college
and their total outstanding payment?
A.
SELECT
studentNo, outstandPay
FROM Student
COUNT (studentNo, outstandPay);
B.
SELECT
COUNT(studentNo, outstandPay ) AS totalStudent,
C.
totalOutstandPay
FROM Student
C.
SELECT
COUNT(studentNo) AS totalStudent,
SUM(outstandPay) AS totalOutstandPay
FROM Student;
D.
SELECT
SUM(studentNo, outstandPay ) AS totalStudent, totalOutstandPay
FROM Student
GROUP BY StudentNo
ORDER BY StudentNo;
14.
Which of the following is NOT the advantage of Database Management System?
A.
B.
15.
Data dependence
Data consistency
C.
D.
Sharing of data
Increased concurrency
Which of the following best describes the relationship for customers who book tickets in a
flight database?
A.
B.
One to one
One to many
C.
D.
Many to many
One to some
SECTION B (35 Marks)
Answer ALL questions. (Answer for structured questions are straight forward that you can refer
them in the notes given at my blog)
Question 1
Briefly describe FIVE (5) limitations of a file-based systems.
(5marks)
Answer:
CONFIDENTIAL/4
FCSIT/IAS2143/IXS2253/JUL12
Question 2
Briefly explain FIVE (5) components of DBMS environment.
(10 marks)
Answer:
Question 3
An attribute is a property of an entity or a relationship type. Describe the following classification of
attributes with examples.
a) Simple attribute.
(2 marks)
b) Composite attribute.
(2 marks)
c) Single-valued attribute.
(2 marks)
d) Multi-valued attribute.
(2 marks)
e) Derived attribute.
(2 marks)
CONFIDENTIAL/5
FCSIT/IAS2143/IXS2253/JUL12
Question 4
a)
What is a degree of relationship?
(1 mark)
b)
Draw an ERD for each of the following degree of relationship:
i)
Unary/Recursive
(2 marks)
ii)
Binary
(2 marks)
iii)
Ternary
(2 marks)
iv)
Quaternary
(3 marks)
CONFIDENTIAL/6
FCSIT/IAS2143/IXS2253/JUL12
SECTION C (40 Marks)
Answer ALL questions.
Question 1
Suppose you are involved in developing a database system for the Sales Department of a company. The
operation of the Department can be described as follows:
They have a file of products that they provide to their customers. Each type of product has a unique
product number, as well as a description, a cost and a price. The number of the product in stock and the
number allocated are updated regularly. When the number in stock decreases to the reorder level, the
product is reordered in a pre-decided quantity.
They have a file of customers. Each customer is given a unique customer number. This file
also contains customer names that consist of their first and last names, and customer addresses
composed of street, city and postcode and the customer telephone number. Each customer has a credit
limit, which is used to validate their orders.
A customer may place zero, one or more orders at a time, and an order is always placed by
one customer alone. Each order is identified by a unique order number. Other information as to orders
includes the date due, the total price, and the status, that is, an order may be outstanding, partially
delivered, or fully delivered and invoiced.
An order may involve one or more than one type of products, and a type of products may be
involved in more than one order. For each product being ordered in an order, its quantity, total price,
and status (i.e., outstanding, partially delivered, or fully delivered) are recorded and updated regularly.
Given this information, draw an Entity-Relationship diagram for this Sales Department.
(20 marks)
(Associated entity - 2 attributes = 2 marks, Entity – name, 2 attibutes, PK = 4
marks (4 entities x 4=12marks), 2 relationships = 2 marks, 4 participation = 4 marks)
Answer:
Two possible answers (a) IsPartOf relationship shown as *:* relationship.
qty
status
/totalPrice
Product
1..*
IsPartOf
productNo {PK}
description
price
cost
numberAllocation
reorderQty
reorderLevel
inStock
0..*
Customer
Order
Places
ordeNo (PK}
status
dateDue
totalPrice
1..*
1..1
custNo {PK}
name
fName
lName
address
street
city
postcode
telNo
creditLimit
CONFIDENTIAL/7
FCSIT/IAS2143/IXS2253/JUL12
(b) The IsPartOf *:* relationship decomposed to identify the OrderDetails entity. (OrderDetails –
2 attributes = 2 marks, Product-entity name, any one attribute, PK = 3 marks, Order- entity
name, any one attribute, PK = 3 marks, Cutomer- entity name, any one attribute, PK = 3
marks, 3 relationship = 3 marks, 4 participations = 4 marks)
OrderDetails
Product
Requires
qty
status
/totalPrice
1..1
0..*
1..*
productNo {PK}
description
price
cost
numberAllocation
reorderQty
reorderLevel
inStock
PartOf
1..1
Customer
Order
Places
ordeNo (PK}
status
dateDue
totalPrice
1..*
1..1
custNo {PK}
name
fName
lName
address
street
city
postcode
telNo
creditLimit
CONFIDENTIAL/8
FCSIT/IAS2143/IXS2253/JUL12
Question 2
Use the following Client and Order schema to answer the following questions
Client ( ClientID, Name, Salary, Position)
Order (ProductID, Product, quantity, Model, ClientID)
a)
Create table client
(2 marks)
Answer:
CREATE TABLE Client (ClientID VARCHAR(5),
Name VARCHAR(15),
Salary DECIMAL(7,2),
Position VARCHAR(15));
b)
Find the clients for whom no Position has been specified.
(2 marks)
Answer:
SELECT ClientID, Name, salary
FROM Client
WHERE Position IS NULL;
c)
Find the clients whom earning more than 50000 per month and list the details in descending
order of Name.
(3 marks)
Answer:
SELECT ClientID, Name, salary
FROM Client
WHERE Salary/12 > 50000
ORDER BY Name DESC;
d)
Find the clients who have ordered printers.
(3 marks)
Answer:
SELECT ClientID, Name, salary
FROM Client
WHERE ClientID = (SELECT ClientID FROM Order WHERE Product = ‘Printer’);
e)
Find the names of clients who have ordered at least 2 keyboards.
(4 marks)
Answer:
SELECT ClientID, Name
FROM Client
WHERE ClientID = (SELECT ClientID FROM Order
WHERE Product = ‘Keyboard’
GROUP BY Product
HAVING COUNT(Product) > 2
ORDER BY ClientID);
CONFIDENTIAL/9
FCSIT/IAS2143/IXS2253/JUL12
f)
Find the Model of printers ordered by James.
(3 marks)
Answer:
SELECT ClientID, Name
FROM Client
WHERE Name = ‘James’
AND ClientID = (SELECT ClientID FROM Order WHERE Product = ‘Printer’);
g)
What is the average salary of Managers?
(3 marks)
Answer:
SELECT AVG(Salary) AS AverageMgrSalary
FROM Client
WHERE Position = ‘Manager’;
END OF QUESTION PAPER
CONFIDENTIAL/10
Download