Test 2 - Databases | Computer Science(CS)
GATE Previous year Topic Wise Questions and Answers | Databases
Questions
Given relations r(w,x) and s(y,z), the result of select distinct w,x from r,s is guaranteed to be the same as r, provided
- r has no duplicate and s is non empty
- r and s have no duplicate
- s has no duplicate and r is non empty
- r and s have the same number of tuples
Suppose the adjacency relation of vertices in a graph is represented in a table Adj (X,Y). Which of the following queries cannot be expressed by a relational algebra expression of constant length?
- List all vertices adjacent to a given vertex.
- List all vertices which have self loops.
- List all vertices which belong to cycles of less than three vertices.
- List all vertices reachable from a given vertex.
Consider the following relation schema pertaining to a students database:
Student (rollno, name, address)
Enroll (rollno, courseno, coursename)
where the primary keys are shown underlined. The number of tuples in the student and Enroll tables are 120 and 8 respectively. What are the maximum and minimum number of tuples that can be present in
(StudentEnroll), where '' denotes natural join?
- 8, 8
- 120, 8
- 960, 8
- 960, 120
Let r and s be two relations over the relation schemes R and S respectively, and let A be an attribute in R. Then the relational algebra expression $\sigma_A =_a (rs)$ is always equal to
- $\sigma_A =_a (r)$
- r
- $\sigma_A =_a (rs)$
- none of the above
Relation R is decomposed using a set of functional dependencies F and relation S is decomposed using another set of functional dependencies G. One decomposition is definitely BCNF, the other is definitely 3NF. To make a guaranteed identification, which one of the following tests should be used on the decompositions? (Assume that the closures of F and G are available).
- Dependency preservation
- Lossless join
- BCNF definition
- 3NF definition
Let $R_1 \left(\underline{A}, B, C\right)$ and $R_2\left(\underline{D}, E \right) $ be two relation schema, where the primary keys are shown underlined, and let C be a foreign key in $R_1$ referring to $R_2$. Suppose there is no violation of the above referential integrity constraint in the corresponding relation instances $r_1$ and $r_2$. Which of the following relational algebra expressions would necessarily produce an empty relation?
- $\Pi_D (r_2) - \Pi_C (r_1)$
- $\Pi_C (r_1) - \Pi_D (r_2)$
- $\Pi_D \left(r_1 \bowtie_{C \neq D}r_2\right)$
- $\Pi_C \left(r_1 \bowtie_{C = D}r_2\right)$
The relation scheme student Performance (name, courselNo, rollNo, grade) has the following functional dependencies:
name, courseNo $\rightarrow$grade
RollNo, courseNo$\rightarrow$grade
name $\rightarrow$rollNo
rollNo $\rightarrow$name
The highest normal form of this relation scheme is
- 2 NF
- 3NF
- BCNF
- 4 NF
The order of an internal node in a B* tree index is the maximum number of children it can have. Suppose that a child pointer takes 6 bytes, the search field value takes 14 bytes and the block size is 512 bytes. What is the order of the internal node?
- 24
- 25
- 26
- 27
Consider the relation Student (name, sex, marks), where the primary key is shown underlined, pertaining to students in a class that has at least one boy and one girl. What does the following relational algebra expression produce?

- names of girl students with the highest marks
- names of girl students with more marks than some boy student
- names of girl students with marks not less than some boy student
- names of girl students with more marks than all the boy students
Which of the following statements about normal forms is FALSE?
- BCNF is stricter than 3 NF.
- Lossless, dependency preserving decomposition into 3 NF is always possible.
- Lossless, dependency preserving decomposition into BCNF is always possible.
- Any relation with two attributes is BCNF.
Consider the following relation instance.
| X | Y | Z |
| 1 | 4 | 2 |
| 1 | 5 | 3 |
| 1 | 6 | 3 |
| 3 | 2 | 2 |
Which of the following functional dependencies are satisfied by the instance?
- XY$\rightarrow$Z and Z$\rightarrow$ Y
- YZ$\rightarrow$ X and Y$\rightarrow$ Z
- YZ$\rightarrow$ X and X$\rightarrow$ Z
- XZ$\rightarrow$ Y and Y$\rightarrow$ X
Let E1 and E2 be two entities in an E-R diagram with simple single valued attributes. R1 and R2 are two relationships between E1 and E2 where R1 is one-to-many and R2 is many-to-many. R1 and R2 do not have any attributes of their own. What is the minimum number of tables required to represent this situation in relational model?
- 2
- 3
- 4
- 5
Which of the following relational calculus expressions is not safe?
The following table has two attributes A and C where A is the primary key and C is the foreign key referencing A with on-delete cascade.

The set of all tuples that must be additionally deleted to preserve referential integrity when the tuple (2,4) is deleted is:
- (3,4) and (6,4)
- (5,2) and (7,2)
- (5,2)(7,2) and (9,5)
- 1
From the following instance of relation schema R(A,B,C), we can conclude that
| A | B | C |
| 1 | 1 | 1 |
| 1 | 1 | 0 |
| 2 | 3 | 2 |
| 2 | 3 | 2 |
- A functionally determines B and B functionally determines C
- A functionally determines B and B does not functionally determine C
- B does not functionally determine C
- A does not functionally determine B and B does not functionally determine C
With regard to the expressive power of the formal relational query languages, which of the following statements is true?
- Relational algebra is more powerful than relational calculus.
- Relational algebra has the same power as relational calculus.
- Relational algebra has the same power as safe relational calculus.
- None of the above
Which one of the following is a key factor for preferring B+-trees to binary search trees for indexing database relation?
- Database relations have a large number of records.
- Database relations are sorted on the primary key.
- B+-trees require less memory than binary search trees.
- Data transfer from disks is in blocks.
The employee information in a company is stored in the relation
Employee (name, sex, salary, deptName)
Consider the following SQL query
select deptname
from Employee
where sex='M'
group by deptName
having avg (salary)>
(select avg(salary)from Employee)
It returns the names of the department in which
- the average salary is more than the average salary in the company
- the average salary of male employees is more than the average salary of all male employees in the company
- the average salary of male employees is more than the average salary of employees in the same department
- the average salary of male employees is more than the average salary in the company
Consider a schema R(A,B,C,D) and functional dependencies A$\rightarrow$ B and C$\rightarrow$ D. Then the decomposition of R into R1(AB) and R2] (CD)g is
- dependency preserving and lossless join
- lossless join but not dependency preserving
- dependency preserving but not lossless join
- not dependency preserving and not lossless join
AB+-tree index is to be built on the Name attribute of the relation STUDENT. Assume that all student names are of length 8 bytes, disk blocks are of size 512 bytes, and index pointers are of size 4 bytes. Given this scenario, what would be the best choice of the degree (i.e. the number of pointers per node) of the B+-tree?
- 16
- 42
- 43
- 44
Consider a relation scheme R = (A,B,C,D,E,H) on which the following functional dependencies hold:
{A $\rightarrow$ B, C $\rightarrow$ D, E $\rightarrow$ C, D $\rightarrow$ A}
What are the candidate keys of R?
- AE,BE
- AE,BE,DE
- AEH,BEH,BCH
- AEH,BEH,DEH
R, (A, B, C, D) is a relation. Which of the following does not have a lossless join, dependency preserving BCNF decomposition?
- A $\rightarrow$ B, B $\rightarrow$ CD
- A $\rightarrow$ B, B $\rightarrow$ C, C $\rightarrow$ D
- AB $\rightarrow$ C, C $\rightarrow$ AD
- A $\rightarrow$ BCD
Relation R with an associated set of functional dependencies, F is decomposed into BCNF. The redundancy (arising out of functional dependencies) in the resulting set of relations is
- zero
- more than zero but less than that of an equivalent 3NF decomposition
- proportional to the size of F+
- indetermine
Consider a relation geq which represents “greater than or equal to”, that is, (x,y) $\epsilon$geq only if y $\le$ x:
Create table gaq
(Ib integer not null
ub integer not null
primary key Ib
foreign key (ub) references geq on delete cascade):
Which of the following is possible if a tuple (x,y) is deleted?
- A tuple (z,w) with z > y is deleted.
- A tuple (z,w) with z > x is deleted.
- A tuple (z,w) with w < x is deleted.
- The deletion of (x,y) is prohibited.
The relation book (title, price) contains the titles and prices of different books. Assuming that no two books have the same price, what does the following SQL query select?
select title from book as B where
(
select count(*)
from book as T
where T. price>B.Price)<5
- Titles of the four most expensive books
- Title of the fifth most inexpensive book
- Title of the fifth most expensive book
- Titles of the five most expensive books
Given the relations employee (name, salary, deptno), and department (deptno, deptname, address). Which of the following queries cannot be expressed using the basic relational algebra operations ($\sigma, \pi, \cup, \cap -$)?
- Department address of every employee
- Employee whose name is the same as its department name
- The sum of all employee salaries
- All employees of a given department






is not safe since no criteria for selection of tuple has been given.



