0% found this document useful (0 votes)
42 views

Midterm

This document contains 13 multiple choice questions about relational databases and relational algebra. The questions cover topics such as foreign keys, joins, projections, selections, aggregations, and identifying primary keys. The answers provided indicate the correct multiple choice option for each question.

Uploaded by

mawada sayed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Midterm

This document contains 13 multiple choice questions about relational databases and relational algebra. The questions cover topics such as foreign keys, joins, projections, selections, aggregations, and identifying primary keys. The answers provided indicate the correct multiple choice option for each question.

Uploaded by

mawada sayed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

1.

Existence of multiple foreign keys in a same relation is possible


A. True
B. False

Answer: A

2. Choose the option that correctly explains in words, the function of the
following relational algebra expression: σyear≥2009 (book ⋈ borrow)

A. Selects all tuples from the Cartesian product of book and borrow
B. Selects all the tuples from the join of book and borrow wherever the year is
lesser than 2009
C. Selects all the tuples from the join of book and student wherever the year is
greater than or equal to 2009
D. Selects all tuples from the Cartesian product of book and borrow wherever
the year is greater than or equal to 2009

Answer: C

3. What does the “x” operator do in relational algebra?


A. Output specified attributes from all rows of the input relation. Remove
duplicate tuples from the output
B. Output pairs of rows from the two input relations that have the same value
on all attributes that have the same name
C. Output all pairs of rows from the two input relations (regardless of whether
or not they have the same values on common attributes)
D. Returns the rows of the input relation that satisfy the predicate

Answer: C
 
4. Choose the correct query to find the sum of the salaries of all employees of the
‘Research’ department, as well as the maximum salary in this department.
Select sum(salary), max (salary)
from employee join department
………………….

A. There is no other query required


B. Where Dname =’Research’
C. Having dDname =’Research’
D. Where Dname =’Research’
Group by Ssn
Answer: B

5. Choose the correct query to list the number of different project locations.
…………………..
From Project
A. There is no other query required
B. Select Plocation
C. Select distinct (Plocation)
D. Select count(distinct (Plocation))
Answer: D
6. Choose the correct query to retrieve the number of employees for each
department where the number of employees is greater than 10 order from the
greatest to the lowest.
Select count (Ssn)
From Project join department
Group by Dname
……………
A. None of them
B. Having count (Ssn)>10
C. Where count (Ssn)>10
D. Where Ssn >10

Answer: A

7. List the names of all employees who have a dependent with the same first
name as themselves.
Select fname
…………..
Where fname =Dname
A. None of them
B. From employee
C. From employee join dependent on Ssn=Essn
D. From dependent

Answer: C
8. A minimum number of tables are required to represent this relational model
is/are……….

A. 1
B. 2
C. 3
D. 5

Answer: B

9. Which of the following possible relations will not hold if the above ERD is mapped
into a relation model?
A. Person (NID, Name)

B. Qualification (NID, ExamID, QualifiedDate)

C. Exam (ExamID, NID, ExamName)

D. Exam (ExamID, ExamName)


Answer: C

10.Choose the option that correctly explains in words, the function of the
following relational algebra expression: π pname (passenger ⨝ booking)
A. Select the passenger names for passengers who have bookings on.
B. Select the passenger names.
C. Select the passenger records who have bookings on flight.

Answer: A
11.Which statement explains in words, the function of the following relational
algebra expression: ρ(Ssn, Net_salary, Bonus, Tax)(π Ssn, Salary,
2000*Years_service, 0.25 * Salary (EMPLOYEE)).

A. Select the Ssn, Salary, 2000 *Years_service, 0.25 * Salary from employees.
B. Select the Ssn, Salary, 2000 *Years_service, 0.25 * Salary from employees
then rename the attributes.
C. Select the employees whose salary more than 2000.

Answer: B
12.In the relation Employee, which attribute represents the recursive relation
A. BDATE
B. SSN
C. SUPERSSN
D. DNO
E. None of the above

Answer: C

13.in the relation works-ON, specify the primary key


A. ESSN
B. PNO
C. ESSN-PNO
D. HOURS

Answer C

You might also like