T4Tutorials .PK

Keys MCQs

Q#1: A key in a database is used to:
(A) Encrypt data
(B) Uniquely identify a record
(C) Store multiple tables
(D) Delete rows
Answer: (B) Uniquely identify a record

Q#2: Which key uniquely identifies each row in a table?
(A) Foreign key
(B) Primary key
(C) Candidate key
(D) Super key
Answer: (B) Primary key

Q#3: A table can have:
(A) Multiple primary keys
(B) Only one primary key
(C) No primary key
(D) Only foreign keys
Answer: (B) Only one primary key

Q#4: A foreign key is used to:
(A) Uniquely identify rows in the same table
(B) Link two tables
(C) Store multiple values
(D) Encrypt data
Answer: (B) Link two tables

Q#5: A candidate key is:
(A) A key that can be chosen as primary key
(B) Always foreign key
(C) Always composite key
(D) Optional key
Answer: (A) A key that can be chosen as primary key

Q#6: A super key is:
(A) A minimal set of attributes
(B) A set of attributes that uniquely identifies a tuple
(C) Always foreign key
(D) Never unique
Answer: (B) A set of attributes that uniquely identifies a tuple

Q#7: A composite key is:
(A) Single column key
(B) Key formed by combining two or more columns
(C) Foreign key only
(D) Candidate key only
Answer: (B) Key formed by combining two or more columns

Q#8: A primary key automatically implies:
(A) Foreign key
(B) NOT NULL and UNIQUE
(C) CHECK constraint
(D) DEFAULT value
Answer: (B) NOT NULL and UNIQUE

Q#9: Surrogate key is:
(A) A key taken from real-world data
(B) Artificial key created to serve as primary key
(C) Foreign key
(D) Candidate key
Answer: (B) Artificial key created to serve as primary key

Q#10: Alternate key is:
(A) A candidate key not chosen as primary key
(B) Another name for foreign key
(C) Always composite
(D) Same as super key
Answer: (A) A candidate key not chosen as primary key

Q#11: A unique key ensures:
(A) Column values are distinct
(B) Column can be null
(C) Column is primary key
(D) Column is foreign key
Answer: (A) Column values are distinct

Q#12: Which key can have multiple null values?
(A) Primary key
(B) Foreign key
(C) Unique key
(D) Composite key
Answer: (C) Unique key

Q#13: The combination of primary key and foreign key is used in:
(A) Entity relationship
(B) Referential integrity
(C) Domain integrity
(D) Domain constraint
Answer: (B) Referential integrity

Q#14: A foreign key in child table must reference:
(A) Any column in parent table
(B) Primary key or unique key in parent table
(C) Foreign key only
(D) Composite key only
Answer: (B) Primary key or unique key in parent table

Q#15: Which key is used to prevent duplicate records in a table?
(A) Primary key
(B) Candidate key
(C) Unique key
(D) Foreign key
Answer: (C) Unique key

Q#16: Minimal super key is called:
(A) Candidate key
(B) Primary key
(C) Foreign key
(D) Composite key
Answer: (A) Candidate key

Q#17: A foreign key may accept:
(A) Only primary key values
(B) NULL values if allowed
(C) Any random value
(D) Only unique key values
Answer: (B) NULL values if allowed

Q#18: Which key is also known as an artificial key?
(A) Surrogate key
(B) Primary key
(C) Candidate key
(D) Composite key
Answer: (A) Surrogate key

Q#19: Composite primary key:
(A) Uses multiple attributes to identify a row
(B) Always foreign key
(C) Cannot have null values
(D) Both A and C
Answer: (D) Both A and C

Q#20: The foreign key maintains:
(A) Entity integrity
(B) Referential integrity
(C) Domain integrity
(D) Attribute integrity
Answer: (B) Referential integrity

Q#21: A table can have how many foreign keys?
(A) Only one
(B) Multiple foreign keys
(C) None
(D) Only two
Answer: (B) Multiple foreign keys

Q#22: Super key may:
(A) Contain extra attributes
(B) Be minimal
(C) Never identify tuples
(D) Always be composite
Answer: (A) Contain extra attributes

Q#23: Candidate key must be:
(A) Unique and minimal
(B) Foreign key
(C) Composite only
(D) Nullable
Answer: (A) Unique and minimal

Q#24: Alternate key can be:
(A) Chosen as primary key
(B) Candidate key not selected as primary
(C) Foreign key
(D) Surrogate key
Answer: (B) Candidate key not selected as primary

Q#25: A natural key is:
(A) Artificial key
(B) Derived from real-world data
(C) Always composite
(D) Always surrogate key
Answer: (B) Derived from real-world data

Q#26: Surrogate key is often used when:
(A) No natural key exists
(B) Tables are small
(C) All keys are foreign keys
(D) Database is hierarchical
Answer: (A) No natural key exists

Q#27: Primary key ensures:
(A) No duplicate row
(B) Every row has a unique identifier
(C) Column is NOT NULL
(D) All of the above
Answer: (D) All of the above

Q#28: Which key may be composite, alternate, or surrogate?
(A) Candidate key
(B) Foreign key
(C) Unique key
(D) Primary key
Answer: (A) Candidate key

Q#29: Composite key is used when:
(A) Single attribute cannot uniquely identify a row
(B) Foreign key exists
(C) Table has only one column
(D) Table is empty
Answer: (A) Single attribute cannot uniquely identify a row

Q#30: Foreign key violation occurs if:
(A) Child table value does not match parent table primary key
(B) Duplicate primary key exists
(C) Null value exists in primary key
(D) Candidate key is missing
Answer: (A) Child table value does not match parent table primary key

Exit mobile version