ITCS 385 - Database Management Systems Midterm Second Semester 2004/2005
ITCS 385 - Database Management Systems Midterm Second Semester 2004/2005
ITCS 385 - Database Management Systems Midterm Second Semester 2004/2005
Midterm
Second Semester 2004/2005
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.
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
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
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
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
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
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
Table1
ID Name Tel
123 XYZ 456
456 ZYX 123
a. 2
b. 3
c. 4
d. 5
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
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
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
25. Consider the relations given above. Will Delete from Student where ID=789 be
successful?
a. Yes
b. No
5
Question 2 [15 points]
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
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.