All questions of Concept of keys for Computer Science Engineering (CSE) Exam

Let R = (A, B, C, D, E, F) be a relation scheme with the following dependencies:
C → F, E → A, EC → D, A → B
Which of the following is a key for R?
  • a)
    CD
  • b)
    EC
  • c)
    AE
  • d)
    AC
Correct answer is option 'B'. Can you explain this answer?

Crack Gate answered
To determine which of the given options is a key for the relation (R), we need to use the given functional dependencies to see which combination of attributes functionally determines all attributes in (R).
Given functional dependencies:
C → F, E → A, EC → D, A → B
Also, remember that we can use the augmentation rule, transitivity, and the union rule to find other implied dependencies.
Let's analyze each option:
Option 1) (CD)
  • Given C → F, so (CD) determines (F).
  • However, there's no direct dependency that allows (CD) to determine (A), (B), (E), or even (D) itself without additional attributes. (CD) does not functionally determine all attributes based on the provided dependencies.
Option 2) (EC)
  • E→ A means (EC) determines (A).
  • A → B implies that with (A), (EC) also determines (B).
  • C → F implies that (EC) also determines (F).
  • Additionally, EC → D, so (EC) also determines (D).
  • Given that (EC) determines (A), (B), (C), (D), (E), and (F), all attributes in (R).
Option 3) (AE)
  • Using (E→ A), (AE) still brings us back to (A). But, given (A), we can determine (B) since (A → B).
  • However, without (C) or another combination, we cannot derive (D), (F) directly from (AE) based on the given dependencies.
Option 4) (AC)
  • C→ F, so (AC) determines (F).
  • A → B so (AC) determines (B).
  • However, (AC) does not directly determine (E) or (D) based on the given dependencies. There's EC → D, but (A) doesn't help in determining (D) or (E).
Conclusion:
Only option 2 ((EC)) is capable of determining all attributes in (R), making it the key for the relation scheme based on the given functional dependencies.

The relation with the attribute which is the Primary key is referenced in another relation. The relation which has the attribute as Primary key is called __________.
  • a)
    Referential relation
  • b)
    Referencing relation
  • c)
    Referenced relation
  • d)
    Referred relation
Correct answer is option 'C'. Can you explain this answer?

Nishanth Mehta answered
Understanding Primary Keys and Relations
In relational database management systems, the concept of primary keys and their relationships is fundamental for maintaining data integrity and establishing connections between different tables.
Primary Key Definition
- A primary key is a unique identifier for each record in a database table.
- It ensures that no two rows have the same key value, which helps in uniquely identifying each entry.
Referenced Relation Explained
- The term "referenced relation" pertains to the table that contains the primary key being referenced by another table.
- This relationship forms the backbone of relational databases, where one table (the referencing relation) points to another (the referenced relation) to establish a link between data.
Referencing vs. Referenced Relation
- The referencing relation is the table that includes a foreign key, which is a field that links back to the primary key in another table.
- The referenced relation (correct answer) is the table that contains the primary key that is referred to by the foreign key in the referencing table.
Example for Clarity
- Consider two tables: `Employees` and `Departments`.
- `Employees` has a primary key `EmployeeID`, while `Departments` may include a foreign key `DepartmentID` that references the `DepartmentID` in `Departments`.
- Here, `Departments` is the referenced relation because it contains the primary key that `Employees` refers to.
Conclusion
Understanding the distinction between referencing and referenced relations is crucial for designing efficient database schemas and ensuring data integrity across related tables. The referenced relation serves as the source of truth for the primary key that other tables depend on for their foreign keys.

Consider the following statements S1 and S2 about the relational data model:
S1: A relation scheme can have at most one foreign key.
S2: A foreign key in a relation scheme R cannot be used to refer to tuples of R.
Which one of the following choices is correct? 
  • a)
    S1 is true and S2 is false.  
  • b)
    Both S1 and S2 are true.  
  • c)
    Both S1 and S2 are false.  
  • d)
    S1 is false and S2 is true. 
Correct answer is option 'C'. Can you explain this answer?

Gate Gurus answered
Concept: 
Foreign Key :is the set of attributes in a particular relation whose values are belongs to primary key of same relation or other relation.
Statement 1: A relation scheme can have at most one foreign key.
There is no such restriction on how many number of Foreign keys a particular relation can have. A relation can have as many number of Foreign keys as Required. 
So this statement is false.
Statement 2: foreign key in a relation scheme R cannot be used to refer to tuples of R.
There is no such constraint. Foreign key can be used to refer to primary key of the same relation. Self-referencing relations are examples of such foreign key. So this statement is also false.
So option 3 is the correct answer.

A field in a table can be taken as a foreign key if
  • a)
    It is present in all other tables
  • b)
    It has unique values
  • c)
    Is a primary key in some other table
  • d)
    None of the above
Correct answer is option 'C'. Can you explain this answer?

  • A foreign key is a field in a table that is a primary key in another table.
  • It is used to establish a relationship between two tables.
  • The foreign key ensures referential integrity of the data, meaning it only allows values that are present in the primary key column of the referenced table.

Which of the following is a fundamental operation in relational algebra?
  • a)
    Set intersection
  • b)
    Natural join
  • c)
    Assignment
  • d)
    None of the mentioned
Correct answer is option 'D'. Can you explain this answer?

Gate Gurus answered
The fundamental operations of relational algebra include selection, projection, union, set difference, Cartesian product, and rename. Set intersection and natural join are not considered fundamental operations but can be derived from these fundamental operations.

A prime attribute of a relation schema 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
Correct answer is option 'B'. Can you explain this answer?

  • Attributes of the relation which exist in at least one of the possible candidate keys, are called prime or key attributes
  • Candidate key is a minimal super key and a Super key is a set of attributes that uniquely identify a tuple in a relation.
  • Therefore, a prime attribute of a relation scheme R is an attribute that appears in some candidate key of R

In relational database minimal super keys is known as -
  • a)
    Reference keys
  • b)
    Candidate keys
  • c)
    Foreign keys
  • d)
    Primary keys
Correct answer is option 'B'. Can you explain this answer?

Nandini Mehta answered
Understanding Minimal Super Keys
In relational databases, the concept of keys is fundamental for establishing relationships between tables and ensuring the integrity of data. Among these keys, candidate keys hold significant importance.
What are Candidate Keys?
- A candidate key is a minimal super key, meaning it is a set of attributes that can uniquely identify a tuple (row) in a relation (table).
- Minimality implies that if any attribute is removed from the candidate key, it will no longer uniquely identify the tuples.
- Each candidate key can serve as a potential primary key for the table.
Characteristics of Candidate Keys:
- Uniqueness: Each value of a candidate key must be unique across the table.
- Irreducibility: No subset of the candidate key can uniquely identify the tuples in the table.
- Multiple Candidates: A table may have multiple candidate keys, but one of them is selected as the primary key.
Examples of Candidate Keys:
- In a student database, attributes like StudentID or a combination of (FirstName, LastName, DOB) could serve as candidate keys, provided they are unique.
Why Candidate Keys Matter:
- Data Integrity: They ensure that no two records are the same based on the key attributes.
- Efficiency: They optimize queries and improve database performance by indexing unique identifiers.
In summary, the correct answer to the question regarding minimal super keys is option 'B' - Candidate keys. They are critical for maintaining the structure and reliability of relational databases.

Assume that AB → C, C  → D and D → A are simultaneously satisfied by a relation r(R). What are the candidate keys of this relation?
  • a)
    AB, CD and AD
  • b)
    AB and CD
  • c)
    AB and DB
  • d)
    ABCD and BC
Correct answer is option 'C'. Can you explain this answer?

Crack Gate answered
If closure defined the complete relation then become the candidate key.
  • Closure of AB =  (AB)+ = {A,B,C,D} //candidate key
  • Closure of BC =  (BC)+ = {A,B,C,D}  //candidate key
  • Closure of CD = (CD)+ = {C,D,A} 
  • Closure of DB = (DB)+= {B,C,D,A} //candidate key
  • Closure of ABCD = (ABCD)+= {A,B,C,D}   //super key
  • Closure of AD = (AD)+ = {A,B,D}
The candidate keys are AB. BC, BD

For each attribute of a relation, there is a set of permitted values, called the __________ of that attribute.
  • a)
    Domain
  • b)
    Relation
  • c)
    Set
  • d)
    Schema
Correct answer is option 'A'. Can you explain this answer?

Mahi Chavan answered
Understanding Domain in Database Relations
In the context of databases, particularly in relational database design, the concept of "domain" is fundamental. Here’s a detailed explanation of why the correct answer is option 'A'.
Definition of Domain
- The domain of an attribute is defined as the set of permissible values that the attribute can take.
- Each attribute in a relation (or table) is associated with a specific domain that constrains the values that can be stored in that attribute.
Importance of Domain
- Data Integrity: Domains ensure that the data entered into the database is valid and consistent. For example, if an attribute is defined to hold integers, the domain restricts entries to integer values only.
- Type Safety: By defining domains, databases enforce type safety. This means that operations performed on the data are appropriate for the data type, reducing errors and enhancing reliability.
Example of Domain
- Consider a database for a library:
- The "Publication Year" attribute might have a domain of years from 1450 to the current year.
- The "Book Title" attribute would have a domain of string values, allowing any sequence of characters.
Conclusion
- By establishing domains for attributes, a relational database maintains high standards of data quality and integrity.
- Therefore, the correct answer to the question is indeed option 'A' — the domain of an attribute is crucial for defining what values are permissible within that attribute.

In context of a relation in database, choose a false statement:
  • a)
    There can be more than one super keys.
  • b)
    A candidate key is a minimal super key.
  • c)
    One of the candidate keys is designated as primary key.
  • d)
    Primary key is obtained by removing one or more attributes from a candidate key.
Correct answer is option 'D'. Can you explain this answer?

Super Key
  • It is an attribute (or set of attributes) that is used to uniquely identifies all attributes in a relation. 
  • All super keys can’t be candidate keys but its reverse is true. 
  • There can be more than one super key.
  • In relation, the number of super keys is always greater than or equal to the number of candidate keys.
  • There always exists at least one super key in a table.
Candidate key
  • It is a minimal set of attributes necessary to identify a tuple; this is also called a minimal super key.
  • Candidate key can be more than one.
  • One of the candidate keys is designated as the primary key.
Primary key
  • Candidate key from the table selected by the database administrator to uniquely identify tuples in a table known as the primary key.
  • Since the candidate is a minimal set of attributes necessary to identify a tuple therefore the primary key is also  a minimal set of attributes necessary to identify a tuple and hence primary key cannot be obtained by removing one or more attributes from a candidate key.
Therefore option 4 is false

Consider the schema R = (A, B, C, D, E, F) on which the following functional dependencies hold:
A ➝ B
B, C ➝ D
E ➝ C
D ➝ A
What are the candidate keys of R?
  • a)
    AEF, BEF and DEF
  • b)
    AEF, BEF and BCF
  • c)
    AE and BE
  • d)
    AE, BE and DE
Correct answer is option 'A'. Can you explain this answer?

Crack Gate answered
Concept:
Candidate key: it is the set of attributes which uniquely identifies a relation. It is also known as superkey with no repeated attributes.
Given relation R = {A, B, C, D, E}
A ➝ B
B, C ➝ D
E ➝ C
D ➝ A
Find the closure of keys given. If all the attributes of relation are present in the closure, then it will be the candidate key of that relation.
Option1: AEF, BEF and DEF
(AEF)+ = {A, E, F, B, C, D}
(BEF)+ = {B, E, F, C, D, A}
(DEF)+ = {D, E, F, C, A, B}
These are the candidate keys of given relation.
Option2: AEF, BEF and BCF
(AEF)+ = {A, E, F, B, C, D}
(BEF)+ = {B, E, F, C, D, A}
(BCF)+ = {B, C, F, D, A}  // E is not present in the closure. Not the candidate key
Option3: AE and BE
(AE)+ = {A, E, C, B, D, }  //F is not present, not a candidate key
(BE)+ = {B, E, C, D, A}   //F is not present, not a candidate key
Option4: AE, BE and DE
(AE)+ = {A, E, C, B, D, } //F is not present, not a candidate key
(BE)+ = {B, E, C, D, A}  //F is not present, not a candidate key
(DE)+ = {D, E, A, C, B}   //F is not present, not a candidate key

An attribute in a relation is a foreign key if the __________ key from one relation is used as an attribute in that relation.
  • a)
    Candidate
  • b)
    Primary
  • c)
    Super
  • d)
    Sub
Correct answer is option 'B'. Can you explain this answer?

Gate Gurus answered
A foreign key in a relation is an attribute that is a primary key in another relation. This key ensures referential integrity between the two relations. For example, in a "Student" table, "DepartmentID" could be a foreign key referencing the "DepartmentID" in a "Department" table.

Which one of the following is a set of one or more attributes taken collectively to uniquely identify a record?
  • a)
    Candidate key
  • b)
    Sub key
  • c)
    Super key
  • d)
    Foreign key
Correct answer is option 'C'. Can you explain this answer?

A super key is a set of one or more attributes that, taken collectively, can uniquely identify a record in a table. This includes primary keys, candidate keys, and any superset of them. For example, in a table of students, the combination of student ID and email could serve as a super key.

Which of the following is used to denote the selection operation in relational algebra?
  • a)
    Pi (Greek)
  • b)
    Sigma (Greek)
  • c)
    Lambda (Greek)
  • d)
    Omega (Greek)
Correct answer is option 'B'. Can you explain this answer?

Crack Gate answered
The selection operation in relational algebra is denoted by the Greek letter Sigma (σ). It is used to select tuples that satisfy a given predicate, such as σ_age > 30 (Employee).

Which of the following is NOT a superkey in a relational schema with attributes V, W, X, Y, Z and primary key V Y?
  • a)
    VXYZ
  • b)
    VWXZ
  • c)
    VWXY
  • d)
    VWXYZ
Correct answer is option 'B'. Can you explain this answer?

Gate Gurus answered
Concept:
Superkey is a set of attributes within a table whose values can be used to uniquely identify a tuple. A candidate key is a minimal superkey.
Superkey is superset of candidate key or primary key.
Explanation:
Primary key is VY. (given)
All superkeys must contain this primary key VY. From the given keys, key, which doesn’t contain the VY.
Here, option 2: VWXZ
“VWXZ” doesn’t contain the primary key VY. So, it is not a superkey.

Relational Algebra is a __________ query language that takes two relations as input and produces another relation as output of the query.
  • a)
    Relational
  • b)
    Structural
  • c)
    Procedural
  • d)
    Fundamental
Correct answer is option 'C'. Can you explain this answer?

Gate Gurus answered
Relational algebra is a procedural query language, meaning it specifies a sequence of operations to perform on relations to achieve the desired result. It involves operations like selection, projection, and join that manipulate relations and produce a new relation.

A __________ is a property of the entire relation, rather than of the individual tuples in which each tuple is unique.
  • a)
    Rows
  • b)
    Key
  • c)
    Attribute
  • d)
    Fields
Correct answer is option 'B'. Can you explain this answer?

A key is a property of the entire relation, ensuring that each tuple (row) in the relation is unique. This is fundamental to the concept of relational databases, where keys ensure the uniqueness and integrity of data. For instance, a primary key in a table uniquely identifies each record.

The subset of a super key is a candidate key under what condition?
  • a)
    No proper subset is a super key
  • b)
    All subsets are super keys
  • c)
    Subset is a super key
  • d)
    Each subset is a super key
Correct answer is option 'A'. Can you explain this answer?

Crack Gate answered
A candidate key is a minimal super key, meaning no proper subset of it can be a super key. If any subset of the super key is still a super key, it cannot be minimal. For instance, if {A, B} is a super key, neither {A} nor {B} alone can be a super key for it to be a candidate key.

For the select operation, the __________ appear in the subscript and the __________ argument appears in the parenthesis after the sigma.
  • a)
    Predicates, Relation
  • b)
    Relation, Predicates
  • c)
    Operation, Predicates
  • d)
    Relation, Operation
Correct answer is option 'A'. Can you explain this answer?

Gate Gurus answered
In the select operation, predicates (conditions) are written in the subscript, and the relation (table) to which these conditions apply is written in the parenthesis after the Sigma (σ). For example, σ_salary > 5000(Employee).

Consider the relation scheme R = (E, F, G, H, I, J, K, L, M, N) and the set of functional dependencies {(E, F} → {G}, {F} → {I, J}, {E, H} → {K, L}, {K} → {M}, {L} → {N}} on R. What is the key for R ?
  • a)
    {E, F}
  • b)
    {E, F, H}
  • c)
    {E, F, H, K, L}
  • d)
    {E}
Correct answer is option 'B'. Can you explain this answer?

Function Dependencies:
{(E, F} → {G}, {F} → {I, J}, {E, H} → {K, L}, {K} → {M}, {L} → {N}}
Option 1: {E, F}
{E, F}+ = {E, F, G, I, J}
Since K, L, M and N is missing in RHS ∴ it is not a key
Also, {E} cannot be a key because {E} is subset of {E, F}
Option 2: {E, F, H}
{E, F, H}+ = {E, F, H, G, I, J, K, L, M, N}
∴ it is a key
Key for R is {E, F, H}.
Important Points:
In relation algebra, key is primary key or candidate key.
{E, F, H, K, L} is super key. 

Chapter doubts & questions for Concept of keys - Database Management System (DBMS) 2025 is part of Computer Science Engineering (CSE) exam preparation. The chapters have been prepared according to the Computer Science Engineering (CSE) exam syllabus. The Chapter doubts & questions, notes, tests & MCQs are made for Computer Science Engineering (CSE) 2025 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests here.

Chapter doubts & questions of Concept of keys - Database Management System (DBMS) in English & Hindi are available as part of Computer Science Engineering (CSE) exam. Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.

Signup to see your scores go up within 7 days!

Study with 1000+ FREE Docs, Videos & Tests
10M+ students study on EduRev