0% found this document useful (0 votes)
4 views12 pages

GATE 2021 Questions

The document discusses various questions and answers related to database management concepts, including functional dependencies, normalization, decomposition, and transaction schedules. It covers specific scenarios involving relational schemas, candidate keys, and the properties of B+ trees. The document also includes multiple-choice questions with explanations for the correct answers.
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)
4 views12 pages

GATE 2021 Questions

The document discusses various questions and answers related to database management concepts, including functional dependencies, normalization, decomposition, and transaction schedules. It covers specific scenarios involving relational schemas, candidate keys, and the properties of B+ trees. The document also includes multiple-choice questions with explanations for the correct answers.
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/ 12

GATE 2021 Questions

Consider the relation R(P,Q,S,T,X,Y,Z,W)R(P,Q,S,T,X,Y,Z,W) with the following


functional dependencies.

PQ→X;P→YX;Q→Y;Y→ZWPQ→X;P→YX;Q→Y;Y→ZW
Consider the decomposition of the relation RR into the constituent relations
according to the following two decomposition schemes.

 D1:R=[(P,QS,T);(P,T,X);(Q,Y);(Y,Z,W)]D1:R=[(P,QS,T);(P,T,X);
(Q,Y);(Y,Z,W)]
 D2:R=[(P,Q,S);(T,X);(Q,Y);(Y,Z,W)]D2:R=[(P,Q,S);(T,X);(Q,Y);
(Y,Z,W)]

Which one of the following options is correct?

A. D1D1 is a lossless decomposition, but D2D2 is a lossy decomposition


B. D1D1 is a lossy decomposition, but D2D2 is a lossless decomposition
C. Both D1 and D2 are lossless decompositions
D. Both D1and D2 are lossy decompositions

Decomposition removes redundancy from the database. it is lossless if it’s possible


to reconstruct the table from the given set of decomposition tables using natural join.

Decomposition of a relation R into R1,R2R1,R2 is a lossless-join decomposition if at


least one of the following functional dependencies are in F+:F+:

1. ((R1∩R2)→(R1−R2))((R1∩R2)→(R1−R2)) is in F+F+ or
2. ((R1∩R2)→(R2−R1)((R1∩R2)→(R2−R1) is in F+F+

 Decomposition is lossless iff R1⋈R2=RR1⋈R2=R

D1:R=[r1(PQST),r2(PTX),r3(QY),r4(YZW)]D1:R=[r1(PQST),r2(PTX),r3(Q
Y),r4(YZW)]

⟹r1∩r2=(PT)+=PTYXZW⟹r1∩r2=(PT)+=PTYXZW which is superkey, we


can combine them.

So new table is x1=(PQSTX)x1=(PQSTX)

In the same way; r3∩r4=Y+=YZWr3∩r4=Y+=YZW


which is SK, and so we can merge them.

Thus x2=(QYZW)x2=(QYZW)

Now x1∩x2=Q+=QYZWx1∩x2=Q+=QYZW which is SK.

So we can get original table (PQSTXYZW)(PQSTXYZW)

So given decomposition D1D1 is lossless join decomposition.

Similarly we can check for D2D2

D2:R=[r1(PQS),r2(TX),r3(QY),r4(YZW)]D2:R=[r1(PQS),r2(TX),r3(QY),r4(
YZW)]

⟹r3∩r4=Y+=YZW⟹r3∩r4=Y+=YZW, is Sk we can merge them.

So new table will be x1=(QYZW)x1=(QYZW)

Similarly x1∩r1=Q+=QYZWx1∩r1=Q+=QYZW is also Sk,we can combine


them.new table will be x2=(PQSYZW)x2=(PQSYZW)

Now x2∩r2x2∩r2 is not superkey. no common attribute is present between them.


We can try any other order of combining the relations and none of them will satisfy
the lossless decomposition condition. Hence it is lossy decomposition.

∴∴ decomposition D2D2 is lossy decomposition.

Option AA is correct.

1. Consider a relational table R that is in 3NF, but not in BCNF. Which one of the following
statements is TRUE?

A. R has a nontrivial functional dependency X→A, where X is not a superkey and A is a


prime attribute.
B. R has a nontrivial functional dependency X→A, where X is not a superkey and A is a
non-prime attribute and X is not a proper subset of any key.
C. R has a nontrivial functional dependency X→A, where X is not a superkey and A is a
non-prime attribute and X is a proper subset of some key
D. A cell in R holds a set instead of an atomic value.

Ans: In 3-NF where functional dependency is of type X ----> Y

X can be super key or Y can be prime attribute


Where as in BCNF where functional dependency is of type X ----> Y

X should be super key ( BCNF is more strict compared to 3NF )

Option (C) says it has partial dependency (not even 2-NF)

Option (D) multiple values in a cell . i.e not atomice ( not even 1-NF)

Option (B) says X is not a super key and Y is not a prime attribute . Therefore not 3-NF

Ans (A) : Says X is not a super key but Y is a prime attribute . Satisfies one of the condition
of 3-NF formal definition

As X is not a Super Key it is not in BCNF


2. Which one of the following is used to represent the supporting many-one relationships of a
weak entity set in an entity-relationship diagram?
A. Ovals that contain underlined identifiers
B. Diamonds with double/bold border
C. Ovals with double/bold border
D. Rectangles with double/bold border
Ans. B

3. Which one of the following statements is NOT correct about the B+ tree data structure
used for creating an index of a relational database table?
A. B+ Tree is a height-balanced tree
B. Non-leaf nodes have pointers to data records
C. Key values in each node are kept in sorted order
D. Each leaf node has a pointer to the next leaf node
Ans. B
Sol.B+ tree non leaf node have pointer to data records is false statement. B+ tree non leaf
node consists of only keys and tree pointers (node pointers). Below is the structure of B+ tree
non leaf node
4. Consider the following two statements about database transaction schedules:
I. Strict two-phase locking protocol generates conflict serializable schedules that are
also recoverable.
II. Timestamp-ordering concurrency control protocol with Thomas’ Write Rule can
generate view serializable schedules that are not conflict serializable.
Which of the above statements is/are TRUE?
A. I only B. II C. Both I and II D. Neither I nor II
Ans. C
Sol. I. Strict 2PL guaranteed conflict serializable because of 2PL condition and also strict
recoverable.
II. Thomas Write timestamp ordering ensures serializable. Thomas write rule timestamp
ordering allowed to execute schedule which is view equal serial schedule based on
timestamp ordering.

5. Let the set of functional dependencies F = {QR → S, R → P, S → Q} hold on a relation


schema X = (PQRS). X is not in BCNF. Suppose X is decomposed into two schemas Y and
Z, where Y = (PR) and Z = (QRS). Consider the two statements given below.
I. Both Y and Z are in BCNF
II. Decomposition of X into Y and Z is dependency preserving and lossless
Which of the above statements is/are correct?
A. Both I and II B. I only C. II only D. Neither I nor II
Ans. C
Sol.X(PQRS) {QR → S, R → P, S → Q} decomposed into Y(PR) Z(QRS) {R → P} {QR →
S, S → Q} Candidate key : R Candidate key : QR, RS Relation Y in BCNF Relation Z in
3NF but not BCNF Common attribute between Y and Z relations is R which is key for
relation Y. So that given decomposition is lossless join decomposition. R → P in Y

are in Z and dependency preserving decomposition. Hence , C is the correct answer.


6.
The primary key of the Student table is Roll_no. For the Performance table, the columns
Roll_no. and Subject_code together form the primary key.
Consider the SQL query given below: SELECT S.Student_name, sum(P.Marks) FROM
Student S, Performance P WHERE P.Marks > 84 GROUP BY S.Student_name;
The number of rows returned by the above SQL query is ________.

.Ans. (5)

Total 5 different student names all 5 group records in result.(In where condition no condition
over Roll_no so query produces all groups.)
Ans. B
GATE-2013

Linked question (13 & 14)

11.Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values.
F={CH→G, A→BC, B→CFH, E→A, F→EG} is a set of functional dependencies (FDs) so
that F + is exactly the set of FDs that hold for R.

13. How many candidate keys does the relation R have?


(a) 3 (b) 4 (c) 5 (d) 6

Ans: option (b)

Explanation:
In a relational database, a key helps to uniquely identify each record within a table . A key is
a combination of one or more fields/attributes in a table. If a relational schema has multiple
keys,each key is a candidate key. One of the candidate keys is chosen as the primary key.
To find the candidate keys, we need to find the closure of each attribute. (If x ia an
attribute(field), set of attributes determined by x under a set F of functional dependencies is
the closure of x under F, denoted x+ ).
Thus,
A+:ABCFHGE
B+: BCFHEGA
C+:C
D+:D
E+: EABCFHG
F+:FEGABCH
G+:G
H+ : H
A+,B+,E+,F+ contains all attributes except D. Thus there are 4 candidate keys DA,DB,DE
and DF.

14. The relation R is


(a) in 1NF, but not in 2NF.
(b) in 2NF, but not in 3NF.
(c) in 3NF, but not in BCNF.
(d) in BCNF.

Ans: option (a)


Explanation:
An attribute that does not occur in any candidate key is called a non-prime attribute.
(Reference: https://en.wikipedia.org/wiki/Candidate_key)

Consider F->G; G is a non-prime attribute and F is a proper subset of a candidate key (refer
the above question). This is a case of partial dependency. Hence 2NF condition is violated.
similarly A->C and B->CH also violates 2NF condition, hence R is not in 2NF.

Since attributes of relation R has only atomic values, R is in 1NF.

In an Entity-Relationship (ER) model, suppose R is a many-to-one relationship from entity set E1 to


entity set E2. Assume that E1 and E2 participate totally in R and that the cardinality of E1 is greater
than the cardinality of E2.

Which one of the following is true about R?

A. Every entity in E1 is associated with exactly one entity in E2.

B. Some entity in E1 is associated with more than one entity in E2.

C. Every entity in E2 is associated with exactly one entity in E1.

D. Every entity in 2 is associated with at most one entity in E1.

Ans. (A) Solutions: E1 entries > E2 entities

So Every entity in E1 is associated with exactly one entity in E2. So options A is correct options.

Suppose a database schedule S involves transactions T ,......., T . 1 n Construct the precedence graph
of S with vertices representing the transactions and edges representing the conflicts. If S is
serializable, which one of the following orderings of the vertices of the precedence graph is
guaranteed to yield a serial schedule?
A. Topological order

B. Depth-first order

C. Breadth-first order

D. Ascending order of transaction indices

ANS:A

2014

A prime attribute of a relation scheme R is an attribute that appears

(A) in all candidate keys of R.

(B) in some candidate key of R.

(C) in a foreign key of R.

(D) only in the primary key of R.

Answer : (B) in some candidate key of R.

prerana-gate-classes-2020-21@mgit.ac.in
prerana-gate-2018-22@mgit.ac.in

3.Consider a schedule of transactions T1 and T2:

Here, RX stands for “Read(X)” and WX stands for “Write(X)”. Which one following
schedules is conflict equivalent to the above schedule?
Ans. D
Sol. R2(B) is conflicting with W1(B) so, W1(B) should always come after R2(B) W2(B) is
conflicting with W1(B) similarly, W1(B) should always come after W2(B) R2(D) is
conflicting with W1(D), so, W1(D) should always come after R2(D) R1(C) is conflicting
with W2(C) so, W2(C) should always come after R1(C)
Therefore the transaction will be:
7.

How many tuples will be returned by the following relational algebra query?

.Ans. (1)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy