ITCS 385 - Database Management Systems Midterm Second Semester 2004/2005

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

UNIVERSITY OF BAHRAIN

COLLEGE OF INFORMATION TECHNOLOGY


DEPARTMENT OF COMPUTER SCIENCE

ITCS 385 - Database Management Systems

Midterm
Second Semester 2004/2005

Time Allowed: 1 Hour

Student Name

Student I.D.

Question 1 30

Question 2 15

Question 3 15

Total 60

1
Question 1 [30 points]. Select the most appropriate answers.

1. Which of the following is not correct?


a. In a database, the related data must belong to the same working organization
b. A database has a specific purpose, set of users, and applications
c. In a database, every facts should be stored
d. A database is stored less redundantly

2. Which of the following is not correct?


a. User models show how the users perceive the mini-world and the business
b. A physical model represents how the database is actually stored on a computer
c. The physical data model is based on user model
d. The relationship between different entities is shown in logical data model

3. A database system is
a. A collection of programs that enables users to create and maintain a database
b. A collection of related data
c. A collection of related data and database management system
d. None of the above

4. Which of the following is NOT a function of DBMS?


a. Provides an efficient ways to store and manipulate data
b. Provides a user-accessible catalog
c. Allows users to enhance the functionality of the DBMS
d. Performs garbage collection

5. The component of a DBMS that is responsible to control access to database or a to


catalog is called
a. DDL compiler
b. DML compiler
c. Stored data manager
d. The query compiler

6. A component of the database schema or an object within the schema is often called
a. A data model
b. Database instance
c. Database Schema
d. Schema construct

7. Assume that you defined/described the structure of the whole database for a
community of users. What schema did you define?
a. External schema
b. Conceptual schema
c. Internal schema
d. All of the above

8. In three-level schema architecture, making a change at conceptual schema does not


require a change in the internal schema. [2 points]
a. True
b. False

2
9. In three-level schema architecture, making a logically correct change in the internal
schema does not require making a change in the conceptual schema.
a. True
b. False

10. Capacity/ability to change conceptual schema of a database without having to change


external schemas or application programs is known as
a. Logical data independence
b. Physical data independence

11. A SQL create table command is a part of --------


a. DML
b. DDL
c. VDL
d. All of the above

12. A data manipulation language in which the user states what data is needed and not
how to get that data from the database is known as
a. Procedural language
b. Non-procedural language
c. Host language
d. Data sublanguage

13. A DBMS architecture in which a computer holds both the database and DBMS software
and other computers connected to it only provide user interface and run applications is
called
a. File server
b. Client-server
c. Teleprocessing
d. None of the above

14. In ER model, an attribute that is composed of several components is called -------


a. A simple attributed
b. A multivalued attribute
c. A composite attributed
d. A derived attribute

15. A collection of all entities of a particular entity type in the database at a given point in
time is called
a. An entity type
b. A entity set
c. An entity-relationship instance
d. None of the above

16. The degree of relationship refer to


a. Number of entities that participate in a relationship
b. Number of entities in your ER diagram
c. Number of entity instance that are involves in a relationship
d. None of the above

17. Assume we have two entities E1(Name=’XYZ’, Age=33) and E2(Name=’XYZ’, age=34,
Tel=12345, address=’There’). Do these entities belong to the same entity type?
a. Yes
b. No

3
18. Suppose that entity EMPLOYEE has an attribute NO-OF-CHILDERN. If an employee can
have 0 or more children, what type of attribute NO-OF-CHILDERN is? [2 points]
a. Multi values
b. Composite
c. Simple
d. Derived

19. What is the cardinality of the following relation?

Table1
ID Name Tel
123 XYZ 456
456 ZYX 123

a. 2
b. 3
c. 4
d. 5

20. Which of the following is a correct relation? [2 points]

a. Table1 b. Table1
ID Name Tel ID Name Tel
123 XYZ NULL 123 XYZ 456
456 ZYX 123 456 ZYX 123
789 XYZ 456 123 XYZ 456

c. Table1 d. Table1
123 XYZ 456 ID Name ID
456 ZYX 123 123 XYZ 456
789 XYZ 456 456 ZYX 123
789 XYZ 456

21. According to the entity integrity constraint


a. No two tuples can have the same combination of values for all their attributes
b. The primary key cannot have a null value
c. Each attribute must have an atomic value
d. None of the above

22. In three level schema architecture, more than one external views can be defined on a
single table.
a. True
b. False

4
23. Which of the following two tables has a foreign key? Tables are defined as: Table1(ID
Number(5), Name character(30), DOB date), Table2 (ID Character(5), Name
number(10), Tel Number(10)). [2 points]

Table1 Table2
ID Name DOB ID Name Tel
123 XYZ NULL T123 1 NULL
456 ZYX 12/1/65 T456 2 123
789 XYZ 30/5/75 T789 3 456

a. Table1
b. Table2
c. Both Table1 and Table2
d. None

24. Consider the following relations [2 points]

Student Department
ID Name Dep Tel DID Name Tel
123 XYZ 3 789 1 CS 4567
456 ZYX 4 123 2 EE 1123
789 XYZ 1 456 3 BIS 4456
987 YXX 2 987 4 EC 6677

Registration Course
CID ID CID Title
385 123 385 DBMS
101 123 101 INTRO
314 456 314 JAVA

Does Insert into registration values (385,123) violate any constraint?


a. Yes
b. No

25. Consider the relations given above. Will Delete from Student where ID=789 be
successful?
a. Yes
b. No

5
Question 2 [15 points]

Consider the following database schema:

Branch(BNO, bstreet, bcity, bcountry)


Staff(SNO, Sname, position, salary, BNO)
Client(CNO, Cname, address, tel)
Registration(CNO,BNO,SNO,datejoined)

1. Which of the following is correct SQL command if we want to display name of all
staff members who are working in branches located in “Isa Town”? [2 points]

a. b.
Select Sname Select Sname
From Staff From branch b, staff s
Where bcity=’Isa Town’ Where bcity=’Isa Town’

c. d. None of these
Select Sname
From branch b, staff s
Where bcity=’Isa Town’
And s.BNO=b.BNO

2. Consider tel attribute in table Client has the format “Code Number” where Code is
a 3-digits number, followed by a space and an 8-digits Number (e.g. 973 34234567).
Which one of the following would be correct use of SUBSTR command to get the
Number part of tel? [1 point]
a. substr(tel,5,8)
b. substr(tel,5,12)
c. substr(tel,6,7)
d. None of the above

3. For which task would it be most appropriate to use keyword DISTINCT? [1 point]
a. Eliminate duplicate rows in the result table
b. Eliminate duplicate columns in the result table
c. Identify duplicate columns in a table
d. Identify which row has unique values

4. Write SQL statements for the following. [3+3+5]


a. Display average, maximum and minimum salary of all employees working in
branch 12.
b. Display name of all clients (Cname) who registered with some branch on
12/4/2005.
c. Display Cname of all clients that have a registration in a branch that is
located in Isa Town.
Answer
a.
Select avg(salary), max(salary), min(salary)
from staff
where BNO=12;

6
b.
select Cname
from client c, registration r
where datejoined=to_date(‘12/04/2005’,’dd/mm/yyyy’);
and c.CNO=r.CNO;

c.

select Cname
from Client c, branch b, registration r
where bcity=’Isa Town’
and c.CNO=r.CNO
and r.BNO=b.BNO;

7
Question 3 [20 points]

An interior design company would like to have a database to represent their operations. A
client (customer) requests the firm to perform one or more jobs such as decorating new
house, redecorating rooms, locating and purchasing furniture etc. Every client is identified
by a unique customer number. A customer may place one or more job orders but a job
belongs to only one customer. One of the firm’s decorators is made in-charge of the each
job. Each decorator has a unique ID, specialty, and address. Each job may involve one or
more activities such as painting, floor covering, wallpapering etc. Each of these activities
must be done by one or more contractors which are hired by the interior design company.
Each contractor has a unique ID, address, and specialty. Start date each job and each
activity must also be stored in the database. A contractor might be working on more than
one activity at the same time.

Make a complete ER diagram. You must clearly show attributes for each entity type and
relationship type, keys, cardinality ratios, and participation constraints. If you assume any
missing information, mention it in your answer. However, you must not assume anything
which is already given in the above description.

You might also like