Question

Consider a relational database schema with a relation R(A,B,C,D)R(A, B, C, D). If {A,B}\{A, B\} and {A,C}\{A, C\} are the only two candidate keys of the relation RR, then the number of superkeys of relation RR is ______. (answer in integer)

Official answer and solution
Official answer
6
From
Official GATE 2026 answer key

Solution

Use the principle of inclusion-exclusion to count all subsets of {A,B,C,D}\{A, B, C, D\} that contain at least one candidate key.

A subset S⊆{A,B,C,D}S \subseteq \{A, B, C, D\} is a superkey of RR if and only if SS contains {A,B}\{A, B\} or SS contains {A,C}\{A, C\}:

  • Number of subsets containing {A,B}\{A, B\}: 24−2=42^{4 - 2} = 4 ({A,B},{A,B,C},{A,B,D},{A,B,C,D}\{A,B\}, \{A,B,C\}, \{A,B,D\}, \{A,B,C,D\})
  • Number of subsets containing {A,C}\{A, C\}: 24−2=42^{4 - 2} = 4 ({A,C},{A,B,C},{A,C,D},{A,B,C,D}\{A,C\}, \{A,B,C\}, \{A,C,D\}, \{A,B,C,D\})
  • Number of subsets containing both {A,B}\{A, B\} and {A,C}\{A, C\} (i.e., containing {A,B,C}\{A, B, C\}): 24−3=22^{4 - 3} = 2 ({A,B,C},{A,B,C,D}\{A,B,C\}, \{A,B,C,D\})

By inclusion-exclusion, the total number of superkeys is 4+4−2=64 + 4 - 2 = 6.

Final answer

6

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2026 Computer Science and Information Technology - Session 1 (CS1)
Question
65 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.