Вы находитесь на странице: 1из 25

lOMoARcPSD|3721797

Final exam 2 8 January, answers

Information Security (Western Sydney University)

StuDocu is not sponsored or endorsed by any college or university


Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)
lOMoARcPSD|3721797

PART A:

Q1.A database is
[a] a shared collection of logically related data
[b] a description of this data in [a]
[c] designed to meet the information needs of an organisation
[d] all of the above
[e] none of the above

Q2.What does the following screenshot for Microsoft ACCESS


indicate?
[a] none of the below
[b] all the below
[c] ownerNo is a candidate key for table PropertyForRent
[d] ownerNo is a foreign key
[e] attribute ownerPhone will be displayed by this query

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

Q3.In the ANSI-SPARC 3 Level Architecture, which of the


following is/are true?

[a] Logical Data Independence refers to the immunity of


conceptual schema to changes in the internal schema

[b] Physical Data Independence refers to the immunity of external


schemas to changes in conceptual schema

[c] Logical model changes due to such as the addition of new


data items should be possible without affecting existing
external views
[d] all of the above
[e] none of the above

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

Q4.Duties expected of a Data administrator (DA) include


[a] database planning

[b] development and maintenance of standards, policies and


procedures
[c] conceptual and logical database design
[d] all of the above

[e] physical database design and implementation, and all of the


above

Q5.Regarding the potential activities involved with each of the


three main phases of database design, which of the following is not
correct?

[a] the conceptual database design phase includes activities such as


identifying entity types, identifying relationship types, and
determining attribute domains

[b] the conceptual database design phase also includes activities


such as determining primary and candidate key attributes, and
checking model for redundancy

[c] the logical database design phase includes activities such as


deriving relations from the conceptual data model, validating
relations using normalisation, and checking integrity constraints

[d] the logical database design phase also includes activities such
as designing security mechanisms for the data entry

[e] the physical database design phase includes activities such


as translating logical data model for the target DBMS,
designing user views, and designing file organisation and
indexes

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

Q6.A weak entity type


[a] does not have a unique identifier within the entity

[b] can not exist on its own, in that its existence is dependent on
another entity type
[c] is also a strong entity type if it contains two or more attributes.
[d] weakens any entity that has a direct relationship with it.
[e] is only [a] and [b] of the above

Q7.If relation Staff has the schema

Staff=(givenName, familyName, building), and has exactly


the following records

Which of the following projections are correct?


[a] ∏familyName, building is

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

[b] ∏givenName, familyName is

[c] ∏givenName, building is

[d] all of the above


[e] only [a] and [b] of the above

Q8.The following ER diagram

implies

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

[a] entity type Dog is a superclass of entity type MaleDog


[b] entity type FemaleDog is a specialization of the entity type Dog

[c] a dog (of Dog type) cannot be both male (of MaleDog
type) and female (of FemaleDog type)
[d] all of the above
[e] only [a] and [b] of the above

Q9.Suppose in a relation

R=(orderId, productId, quantity, orderDate),attribute orderId


uniquely determines orderDate, and quantity fully depends on both
orderId and productId. Then
[a] orderId, productId → quantity, orderDate

[b] orderId and productId together comprise a candidate key for the
relation R

[c] orderId, productId → orderDate show a partial


functional dependency
[d] all of the above
[e] only [a] and [b] of the above

Q10.The multiplicities shown in the ER diagram below

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

indicate

[a] one staff manages at most one branch, and some branches may
not be managed by any staff

[b] some branches may be managed jointly by more than one


staff, and some staff may not manage any branches

[c] each branch has to be managed by exactly one staff, and


every staff has to manage a particular branch

[d] one staff may manage one or more branches, and some staff
may not manage any branches
[e] none of the above

Q11.Suppose a relation R(A, B, C, D, E, F) has attributes A, B, C,


D, E and F. All the functional dependencies in this relation are
either included in
A→ B,C,D,E
E→F
or derivable there, see the diagram below

This relation is

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

[a] in UNF, i.e. un-normalised form


[b] in 1NF, but not in 2NF
[c] in 2NF, but not in 3NF
[d] in 3NF
[e] none of the above

Q12.Consider the following table of data with fields A, B, C, D,


and E.

Which of the following functional dependencies are


consistent with the records in the above table?
[a] A→ C,D,E
[b] A,B→ C,D,E
[c] B,D→ C
[d] all of the above
[e] none of the above

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

Q13.For the schedule of the transactions T1 and T2 depicted in the


table below in which the balx column denotes the corresponding
value of balx in the database, what kind of problem is there that is
caused by concurrency?

[a] Lost Update problem


[b] Uncommitted Dependency problem
[c] Inconsistency Analysis problem
[d] ACID Deficiency problem
[e] none of the above

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

PART B:
Q32. [10 marks]
Consider the following table schemas for the hotel reservation
Pet(petId, petName, sex, petTypeId*)
PetType(petTypeId, animalType, breed)

Owner(ownerId, firstName, lastName, homePhoneNumber,


streetAddress, suburb, postcode)
PetAndOwner(ownerId*, petId*)

in which the underlined attributes form the primary key and


the starred attributes are foreign keys. Its global relation
diagram is depicted below.

[a] List all the names of the pet owners and their home phone
numbers in the suburb 'Parramatta'.

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

[b] List all the nicknames owners have given to their pet of
type 'cat'.

[c] List all the ownerId and the total number of pets owned by
this owner.

[d] Create in SQL the tables for the relations Owner and
PetAndOwner.

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

CREATE TABLE Owner (


ownerId VARCHAR(10) PRIMARY KEY,
firstName VARCHAR(20),
lastName VARCHAR(20),
homePhoneNumber VARCHAR(20),
streetAddress VARCHAR(80),
suburb VARCHAR(20),
postcode VARCHAR(10)
);

CREATE TABLE Pet (


petId VARCHAR(10) PRIMARY KEY,
petName VARCHAR(20),
sex CHAR(1)
CHECK (sex IN ('M', 'F')),
petTypeId VARCHAR(10)
FOREIGN KEY (petTypeId)
REFERENCES PetType(petTypeId)
);

CREATE TABLE PetAndOwner (

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

ownerId VARCHAR(10), petId


VARCHAR(10), PRIMARY KEY
(ownerId, petId),

FOREIGN KEY (ownerId) REFERENCES Owner,


FOREIGN KEY (petId) REFERENCES Pet
);

Q33. [5 marks]
Suppose relation R has the schema

R(Order_ID, Order_Date, Customer_ID,


Customer_Name, Customer_Address,

Product_ID, Product_Description, Product_Finish,


Unit_Price, Order_Quantity)
and has the following functional dependencies

Order_ID → Order_Date, Customer_ID,


Customer_Name, Customer_Address
Customer_ID → Customer_Name, Customer_Address

Product_ID → Product_Description, Product_Finish,


Unit_Price
Order_ID, Product_ID → Order_Quantity
see also the dependency diagram below.

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

Normalise the above dependency diagram into Second Normal


Form (2NF) and Third Normal Form (3NF). Provide reasoning and
show all your work. Draw the global relation diagram for the 3NF
only.

3NF-GRD

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

Database Design Case Description:


A combined medical and herbal centre wants to create a database
to keep track of its medics, patients, herbal medicine, and herbal
prescriptions. For simplicity, both a herbal medic and a patient will
be recorded for his or her name, a herbal medicine will be
recorded for its name, unit and the price per unit, and a
prescription will be recorded for its date, the patient and medic,
and all the herbs included in the prescription.

[a] For the conceptual database design phase, design your database
in terms of an Entity- Relationship (ER) diagram. This ER
diagram should include explicitly the primary keys, the
participation multiplicities for the relationship type/s. State the
additional assumptions, if any, that are crucial to the design in your
final ER diagram.

(The ER diagrams for this and the following questions must adopt
the symbols, notations, and styles used throughout the textbook
by Connolly and Begg.) [4 marks]

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

[b] For the logical database design phase, map the final ER
diagram into the global relation diagram. Indicate all the
primary keys, foreign keys, multiplicity constraints, as well as at
least the crucial attributes. (Here “crucial” is in regard to the
database design, not necessarily to the needs of business
information.) [3 marks]

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

[c] Write an SQL script (of statements) that generates at least 2


tables for your designed database in above with proper primary
keys and foreign keys if any. At least one of these 2 tables should
contain a foreign key that is related to at least one of the tables
you created via SQL here. [2 marks]
CREATE TABLE Medics(
medicsId varchar(2) PRIMARY KEY,
medicsName varchar(10)
);

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

CREATE TABLE Patients( patientsId


varchar(2) PRIMARY KEY,
patientsName varchar(10) );

CREATE TABLE HerbalMedicine


( herbalMedicineId varchar(2) PRIMARY
KEY, herbalName varchar(10), unit
varchar(10),
pricePerUnit varchar(10)
);

CREATE TABLE HerbalPrescription


( herbalPrescriptionId varchar (2) PRIMARY
KEY, dateT datetime,
medicsId varchar(2),
CONSTRAINT medicsId_FK
FOREIGN KEY (medicsId) REFERENCES Medics,
patientsId varchar(2),
CONSTRAINT patientsId_FK
FOREIGN KEY (patientsId) REFERENCES Patients,

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

herbalMedicineId varchar(2),
CONSTRAINT herbalMedicineId_FK

FOREIGN KEY (herbalMedicineId) REFERENCES


HerbalMedicine,
);

Notes for Q32-Q35.

- The Hotel-Booking model in Tutorial 6 may be used to write


SQL queries.
HOTEL / ROOM / GUEST / BOOKING
create table Hotel (
hotelNo numeric(10),
hotelName varchar(20),
city varchar(8),
constraint hotel_PK PRIMARY KEY(hotelNo)
);

CREATE TABLE Room (


roomNo numeric(10),
hotelNo numeric(10),
type varchar(20),
price money,

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

CONSTRAINT room_pk PRIMARY KEY(roomNo, hotelNo),


CONSTRAINT hotel_fk FOREIGN KEY(hotelNo)
REFERENCES Hotel
);

CREATE TABLE Guest (


guestNo numeric(10),
guestName varchar(20),
guestAddress varchar(30),
CONSTRAINT guest_pk PRIMARY KEY(guestNo)
);

CREATE TABLE Booking (


hotelNo numeric(10),
guestNo numeric(10),
dateFrom datetime,
dateTo datetime,
roomNo numeric(10),

CONSTRAINT booking_pk PRIMARY KEY(hotelNo, guestNo,


dateFrom),

CONSTRAINT room_fk FOREIGN KEY(roomNo, hotelNo)


REFERENCES Room,

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

CONSTRAINT guest_fk FOREIGN KEY(guestNo)


REFERENCES guest
);

- The normalisation examples in the tutorials and in the


lecture notes will be helpful.
- Revise SQL with JOIN, AGGREGATE functions, etc.

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)


lOMoARcPSD|3721797

- Know how to design a database.

- The case study in the last question is for illustration only. It does
not imply that the case

study in the final exam will be similar in any way in its business
nature.

Downloaded by kush vinod rajput (kush.rajput@riarauniversity.ac.ke)

Вам также может понравиться