GATE / CS ARCHIVE

SIMILAR QUESTIONS / DATABASE MANAGEMENT SYSTEMS

Find minimal keys using attribute closure

5 questions solved the same way, newest first. Back to Database Management Systems

How these are solved

Compute closures under stated functional dependencies, verify all attributes are reached, and remove unnecessary determinant attributes. The older task enumerates every minimal key; the newer task selects a key from options.

1 mark · MCQ
Report issue

Functional Dependencies & Keys

Question 21, GATE 2014: For R(E,F,G,H,I,J,K,L,M,N), the functional dependencies are EF→G, F→IJ, EH→KL, K→M, L→N. Which is a candidate key? A: EF. B: EFH. C: EFHKL. D: E.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (2 steps)

1. Method and setup. Attributes absent from every dependency’s right side cannot be generated from other attributes. Thus E, F and H must occur in every key. Compute their closure systematically, and distinguish a minimal candidate key from a larger superkey such as EFHKL.

2. Work through the result and its assumptions. E, F, H never occur on a right-hand side, so every key needs all three. Their closure addsG via EF, I, J via F, K, L via EH, then M, N. Thus EFH determines all attributes and is minimal, B.

Original paper, page 12 · Answer key

2 marks · MCQ
Report issue

Candidate keys from the functional dependencies

Functional Dependencies & Keys

Question 54, GATE 2013: R(A, B, C, D, E, F, G, H) has atomic fields and exactly FD closure generated by CH→G, A→BC, B→CFH, E→A, F→EG. Number of candidate keys: A3, B4, C5, D6.
Question 54, GATE 2013: R(A, B, C, D, E, F, G, H) has atomic fields and exactly FD closure generated by CH→G, A→BC, B→CFH, E→A, F→EG. Number of candidate keys: A3, B4, C5, D6.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (8 steps)

D never occurs on any right-hand side, so every key must contain D. The dependencies A→B, B→F, F→E and E→A form a reachability cycle among A, B, E, F. Starting from any one of those four attributes derives the other three, C and H through B→CFH, and G through F→EG. Consequently A+, B+, E+, F+ each equal {A, B, C, E, F, G, H}, missing only D. Thus AD, BD, DE and DF are candidate keys, and each is minimal. For completeness, any set containing none of A, B, E, F can include only C, D, G, H; its closure can at most add G via CH→G and can never reach that four-attribute cycle. Therefore every key includes at least one of A, B, E, F, and a minimal key includes exactly one together with D. There are precisely four candidate keys, option B.

Compute closures to establish keys and then prove the list exhaustive. D cannot be derived because it never appears on an FD right side, so it must be supplied. Any one of A, B, E, F reaches all the other members of that cycle and then C, H, G. Supplying D alongside one therefore determines all eight attributes. With none of A, B, E, F, the remaining C, D, G, Hcannot generate an entry point into the cycle. Consequently a minimal key consists of Dplus exactly one cycle member: four possibilities.

Original paper, page 12 · Answer key

2 marks · MCQ
Report issue

Candidate keys with two mandatory attributes

Functional Dependencies & Keys

Question 78, GATE 2005: R(A, B, C, D, E, H), FDs A→B, BC→D, E→C, D→A. Candidate-key sets: A AE, BE; B AE, BE, DE; C AEH, BEH, BCH; D AEH, BEH, DEH. Option C uses the clearer GateForum BEH; GFG appears to print BEE in that position.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step through it (6 steps)

Neither E nor H appears on any dependency right-hand side, so every key contains both. E supplies C. Adding A yields B then D through BC→D; adding B yields D then A; adding D yields A then B. Thus AEH, BEH, DEH each determine all six attributes. EH alone cannot determine A, B, D, and adding only C gives nothing new, so these are precisely the minimal keys, option D.

Attributes absent from all FD right sides cannot be manufactured by closure, so every key includes E, H. With them C becomes available. Add A: obtain B, then D. Add B: combine with C to obtain D, then A. Add D: obtain A then B. Thus all three listed triples are superkeys. Removing their third attribute leaves EH with only E, H, C, proving minimality; adding C instead cannot unlock A, B, D. This also proves there are no omitted minimal keys.

Original paper, page 10

1 mark · MCQ
Report issue

Candidate key from a dependency chain

Functional Dependencies & Keys

Question 1.24, GATE 1999: R(A,B,C,D,E,F) has C→F,E→A,EC→D,A→B. Choose a key from CD,EC,AE,AC.
Tap to enlarge
Your answer
Answer & solution

Answer: B: EC (no official key was published)

Step through it (2 steps)

Start the closure of EC with E,C. E→A adds A; A→B adds B; C→F adds F; and EC→D adds D. Thus (EC)+ contains every attribute, so EC is a superkey. Neither E nor C occurs on a right-hand side, so neither can be obtained from other attributes; every key must contain both. Therefore EC is also minimal, a candidate key, and B is correct. Each other listed pair is missing E or C.

Original paper, page 3

Descriptive
Report issue

Finding all minimal keys

Functional Dependencies & Keys

Question 26(b), GATE 1995: For R(A,B,C), with AB→C and C→A, determine every minimal key.
Question 26(b), GATE 1995: For R(A,B,C), with AB→C and C→A, determine every minimal key.
Tap to enlarge
Answer & solution

Answer: AB and BC are exactly the candidate keys. (no official key was published)

Step through it (4 steps)

A candidate key must determine all three attributes, and none of its proper subsets may do so. Since B does not occur on the right side of either given functional dependency, starting from attributes that omit B can never derive B. Thus every key must contain B. The closure B+ is just {B}, so B by itself is not enough.

Add A: (AB)+ initially contains A,B and then AB→C adds C, so AB is a superkey. Removing A leaves B+, which lacks A,C; removing B leaves A+={A}. Therefore AB is minimal. Add C instead: (BC)+ contains B,C, then C→A adds A, so BC is a superkey. Removing B leaves C+={C,A}, and removing C leaves B+={B}; neither is all of R. Thus BC is minimal.

These are exhaustive. Any key must contain B and at least one of the other two attributes. Such a set therefore contains AB or BC. The only larger possibility ABC is a superkey but not a minimal key, because either of those proper subsets already determines R. Hence the complete candidate-key set is {AB,BC}, not just the first key suggested by the dependency AB→C. No extra dependencies are assumed.

Original paper, page 8