Database - Final
1-How many entities are represented by the following requirements?
Company ABC keeps track of its 50 Items, 10 Employees, 5 vendors, and 3 suppliers.
A. 69 B. 68 C. 5 D. 4
Correct answer: D
2-An example of a multi-valued attribute might be _______?
A. Employee_age
B. Employee_email
C. Employee_name
D. Employee_salary
Correct answer: B
3-One of the following statements is correct:
A. A ternary relationship contains two entities and one relationship between them.
B. A recursive relationship is a relationship between an entity and an instance of that entity.
C. A minimum cardinality is the minimum number of entity instances that may participate in a
relationship instance.
D. All instances of an entity class have the same attributes.
Correct answer: C, D And the most correct C
4-A regular entity must have at least one of the following attributes:
A. Optional attribute
B. Derived attribute
C. Composite attribute
D. Unique attribute
Correct answer: D
5-Consider the following statements S1 and S2 about the relational data model:
S1: A relation scheme can have at most one foreign key.
S2: A foreign key in a relation scheme R cannot be used to refer to tuples of R.
Which one of the following choices is correct?
A. S1 is false and S2 is true.
B. Both S1 and S2 are false.
C. Both S1 and S2 are true.
D. S1 is true and S2 is false.
Correct answer: B
6-Multivalued attribute is mapped into a relational schema as ..........
A. an optional column
B. it is not mapped into the relational schema
C. a column or relation
D. a separate relation that has composite primary key
Correct answer: D
7-Transform the following ER diagram into a relational schema.
A. Employee(SSN , EName), Department(DNo , DName), SSN , Start_date
B. Employee(SSN , EName, DNo , Start_date), Department(DNo , DName)
C. Employee(SSN , EName, SSN), Department(DNo , DName)
D. Employee(SSN , EName, Start_date), Department(DNo , DName, SSN)
Correct answer: A
8-Let E be an entity set in a relationship set R. If every entity in E participates in at least one
relationship in R, then the participation of E in R is ________.
A. Incomplete
B. Complete
C. Mandatory
D. Optional
Correct answer: B
9-Which of the following is a false statement?
A. The relation resulting from mapping a weak entity (with a 1:M identifying relationship) has
composite primary key that is composed by the partial identifier and a foreign key corresponding
to the primary key of the owner entity.
B. An optional attribute of an entity is mapped as a column of a relation.
C. An entity and its 1:M unary relationship are mapped as one relation.
D. When an entity has multiple unique attributes, each one of them is mapped as primary key
for the resulting relation.
Correct answer: D
10-Given table Book(title, copy, date of publication), then the following two insert statements will
violate:
Insert into Book values("ABC", 2, 1/2/2023);
Insert into Book values("ABC", 3, "First of July");
A. Referential Entity integrity constraints
B. Entity constraints
C. Domain constraints
D. Key constraints
Correct answer: C
11-The entity integrity rule requires that:
A. A part of the key may be null.
B. All entries are unique.
C. No attribute in the primary key can take on null values.
D. Foreign key values do reference primary key values.
Correct answer: C
12-Which command would be used to delete the table row where the P_Code = '2238/QPD'?
A. ROLLBACK FROM PRODUCT WHERE P_CODE = '2238/QPD';
B. ERASE FROM PRODUCT WHERE P_CODE = '2238/QPD';
C. REMOVE FROM PRODUCT WHERE P_CODE = '2238/QPD';
D. DELETE FROM PRODUCT WHERE P_CODE = '2238/QPD';
Correct answer: D
13-Complete the SQL statement: ______ CUSTOMER SET Name = "Ahmad" WHERE city =
"Irbid";
A. select B. update
C. change D. delete
Correct answer: B
14-Find the SQL statement below that is equal to the following: SELECT NAME FROM
CUSTOMER WHERE STATE = 'VA';
A. SELECT NAME IN CUSTOMER WHERE STATE = 'VA';
B. SELECT NAME IN CUSTOMER WHERE STATE IN ('VA');
C. SELECT NAME IN CUSTOMER WHERE STATE = 'V';
D. SELECT NAME FROM CUSTOMER WHERE STATE IN ('VA');
Correct answer: D
15-What will happen when the following query is executed: UPDATE student SET s_class='SR';
A. The first record in the student table will be updated
B. All records in the student table will be updated
C. An error will occur
D. No records in the student table will be updated
Correct answer: B
16-Which SELECT statement should you use if you want to display unique combinations of the
POSITION and MANAGER values from the EMPLOYEE table?
A. SELECT position, manager DISTINCT FROM employee;
B. SELECT DISTINCT position, DISTINCT manager FROM employee;
C. SELECT position, manager FROM DISTINCT employee;
D. SELECT DISTINCT position, manager FROM employee;
Correct answer: D
17-Which of the following declares a column named "X" that always contains exactly 30
characters?
A. char(30) X
B. varchar(30) X
C. X varchar(30)
D. X char(30)
Correct answer: D
18-How many tuples return by the following SQL command:
SELECT Grade FROM Student ORDER BY Name;
A. 5 B. 3 C. 1
D. 2 E. 4
Correct answer: A
19-Table Employee has 10 records. It has a non-NULL SALARY column which is also UNIQUE.
The SQL statement:
SELECT COUNT(*) FROM Employee WHERE SALARY > ANY (SELECT SALARY FROM
EMPLOYEE);
will print:
A. 10 B. 9
C. 5 D. 0
Correct answer: B
20-The minimum cardinality (# of tuples) of ℑcount(B), Sum(B) (πB, C(S)) is
A. 2
B. 1
C. 4
D. 3
Correct answer: B
21-Select the relational algebra expression that is almost equivalent to the following SQL
statement:
SELECT DISTINCT name FROM Student, Result WHERE Student.no = Result.no AND grade
= 'A';
A. σ_name(Student ∞ (π_grade='A'(Result)))
B. π_name(S ∞ (σ_grade='A'(R)))
C. π_name(Student ⋈_Student.no=Result.no (σ_grade='A'(Result)))
D. π_name(Grade='A' (Student ∞ Result))
Correct answer: C
22-Consider the join of a relation R with relation S. If R has m tuples and S has n tuples, then
the maximum size of join is:
A. 2 * (m + n)
B. m * n
C. m + n
D. (m + n) / 2
Correct answer: B
23-The natural join is equal to:
A. Cartesian product followed by selection then projection
B. Cartesian product followed by selection
C. Cartesian product followed by union
D. Only Cartesian Product
Correct answer: A
24-Consider the following schema that consists of two relations R(A, B, C), S(B, C, D). R has 4
tuples and S has 6 tuples. R and S are union compatible. Based on this information, answer the
following question:
R ∞ S has __________ attributes.
A. 6 B. 3 C. 5 D. 8
Correct answer: B
25-Given the two relations R(A,B,C) and S(A,B,C), which of the following is always true:
A. π_A(R) yields the same result as π_A(S)
B. R - S yields the same result as S - R
C. R ∩ S yields the same result as S ∩ R
D. ALL of answers are true
Correct answer: C
26-Given the table Emp_Proj(proj_num, emp_num, proj_name, emp_name, job_class,
chg_hours, hours), which of the following is a partial dependency?
A. proj_num, emp_num ==> hours
B. proj_num ==> proj_name
C. job_class ==> chg_hour
D. proj_num, emp_num ==> chg_hours
Correct answer: B
27-The functional dependency A ⇒ B for relation schema R(A, B, C, D) implies that:
A. Any two tuples in R that have the same value for B must have the same value for A
B. No two tuples in R can have the same value for attribute B
C. No two tuples in R can have the same value for attribute A
D. Any two tuples in R that have the same value for A must have the same value for B
Correct answer: D
28-Given the relation schema R(A, B, C, D) and functional dependencies F = {A ⇒ C, D ⇒ B}.
Which functional dependency causes a violation of second normal form?
A. Both A ⇒ C and D ⇒ B
B. Only A ⇒ C
C. Only D ⇒ B
D. None of the options
Correct answer: A
29-A relation R(A,B,C) satisfies the functional dependencies A ==> B and A ==> C. The another
functional dependency that R must satisfy so these three functional dependencies (i.e., A ==> B
and A ==> C, and the new functional dependency) allow us to infer that it also satisfies B ==> C.
A) B ==> A
B) A ==> B, C
C) A ==> A, B
D) A ==> A, C
Correct Answer:A
30-A relation R(A, B, C) satisfies the functional dependencies A ⇒ B, A ⇒ C, B ⇒ A. One of the
following is correct:
A. All of the answers
B. {A}+ = A, B, C
C. A and B are candidate keys
D. {B}+ = A, B, C
Correct answer: A
31-Consider the relation X(P, Q, R, S, T, U) with the following set of functional dependencies:
FD1 = {P, R} ==> {S, T}
FD2 = {P, S, U} ==> {Q, R}
Which of the following is the trivial functional dependency?
A. {P, R} ==> {S, T}
B. {P, S, U} ==> {Q}
C. {P, R} ==> {R, T}
D. {P, S} ==> {S}
Correct Answer: D
32-If attribute A determines both attributes B and C, then it is also true that:
A. A ==> B
B. (B,C) ==> A
C. B ==> A
D. C ==> A
Correct Answer: A
33-Which of the following (regarding the relation ENROLLMENT) represents the modification
anomaly?
A. If a student ID changes, we may have to change the major ID as well
B. If a student decides to use a longer version of his or her name, we cannot accommodate that
modification
C. If a major name changes, it may have to be changed in more than one record
D. If a major ID changes, we may have to change the student ID as well
Correct Answer: C
34-Which of the following functional dependencies does NOT exist in the table ENROLLMENT?
A. MajorName ==> StudentName
B. StudentID ==> MajorName
C. StudentID ==> MajorID
D. MajorID ==> MajorName
Correct Answer: A
35-What is the degree of normalization in which the R relation can be classified? Relation:
R(patient, consultant, hospital, address, date, time) Given: patient, consultant ==>
hospital, address, date, time and hospital ==> address
A. 1NF but not in 2NF
B. Unnormalized
C. 2NF but not in 3NF
D. 3NF
Correct Answer: C
36-Consider the following relation schema R(A, B, C, D, E, F, H) and its functional
dependencies: AB ==> CD, A ==> EF, F ==> H. How many new relations will produce after
normalizing R into 3NF?
A. 3 B. 1 C. 2 D. 4
Correct Answer: A
37-Given the set of functional dependencies, (AB ==> CDE and A ==> E), for relation
schema R=(A,B,C,D,E), assume the key is AB. We can infer the following:
A. R is in 3NF B. R is in 2NF
C. R is not in 2NF D. None
Correct Answer: C
38-Given a relation R(A, B, C, D) with F = {A ==> C, BC ==> D}, the dependency AB ==> D is
inferred by ______ rule.
A. pseudo-transitive B. reflexive
C. augmentation D. transitive
Correct Answer: D
39-Assume the relation R(A, B, C, D, E) is in at least 3NF. Which of the following functional
dependencies must be FALSE?
A. A, B -> E B. A, B -> D
C. C, D -> E D. A, B -> C
Correct Answer: C
40-Normalize the following relation R(C, S, D, M, T) to 2NF using the following FDs: {D ==> T, S
==> M}.
A. R1(C,S,D,M) R2(D,T)
B. R1(C,D,T) R2(S,M)
C. R1(C,S,D,T) R2(S,M)
D. R1(C,S,D,T,M)
Correct Answer: A