Database & Data Handling (NCCIA) MCQs
1999 MCQs is category mein available hain.
All MCQs in Database & Data Handling (NCCIA)
641 Which relationship type is hardest to change later if the business rule changes from one-to-many to many-to-many?
A
One-to-one
B
Many-to-many
C
One-to-many, because a foreign key must be replaced by a junction table
D
Self-referencing
Explanation
Changing to many-to-many means removing the single foreign key and creating a junction table, then migrating existing links into it.
Last verified on 27-11-2026
642 An Invoice has a CustomerID and a SalespersonID. What does this show?
A
The Invoice has no parent
B
The Invoice is in a many-to-many relationship
C
The Invoice is in two one-to-many relationships, one with Customer and one with Salesperson
D
The Invoice is self-referencing
Explanation
Each foreign key is a separate link, so one invoice belongs to one customer and is handled by one salesperson, while each customer and salesperson can have many invoices.
Last verified on 27-11-2026
643 In an OrderLine table, (OrderID, ProductID) is a composite foreign key to what?
A
To Order alone
B
To Product alone
C
To Customer
D
OrderID references Order and ProductID references Product, as two separate foreign keys
Explanation
In OrderLine, each column is a separate single-column foreign key to its own parent, not one composite key to a single table.
Last verified on 27-11-2026
644 A composite foreign key (DeptID, SectionID) referencing Department(DeptID, SectionID) must match:
A
Both columns together, as a pair
B
Only SectionID
C
Only DeptID
D
Any one of the two columns
Explanation
A composite foreign key matches the whole composite primary key, so both values must exist together in the parent table.
Last verified on 27-11-2026
645 Which of the following is a valid foreign-key implementation for a one-to-one User-Profile link?
A
Profile.UserID as a plain column with no constraint
B
Profile.UserID as a foreign key with a UNIQUE constraint, referencing User.UserID
C
User.UserID as a foreign key in User
D
Two junction tables
Explanation
The UNIQUE constraint on the foreign key ensures each user links to at most one profile, giving a true one-to-one link.
Last verified on 27-11-2026
646 How can a one-to-one relationship be enforced if the foreign key is placed in the parent table instead?
A
By adding a junction table
B
By removing the primary key
C
By adding a UNIQUE constraint on that foreign key as well
D
By making the foreign key nullable only
Explanation
Whichever table holds the foreign key, a UNIQUE constraint on it limits each row to one linked row, enforcing one-to-one.
Last verified on 27-11-2026
647 What is the effect of making a foreign key column NOT NULL?
A
The parent becomes optional
B
Child rows can exist without a parent
C
The foreign key becomes a primary key
D
Every child row must be linked to a parent row
Explanation
A NOT NULL foreign key makes the relationship mandatory, so a child cannot be stored without its parent.
Last verified on 27-11-2026
648 What is the effect of allowing NULL in a foreign key column?
A
The relationship becomes optional on the child side
B
The table has no primary key
C
The parent must exist
D
The foreign key is ignored
Explanation
A null foreign key means the child row has no parent assigned, which models an optional relationship.
Last verified on 27-11-2026
649 In a Library system, a Book may have a Borrower or be on the shelf. How is BorrowerID best defined?
A
As a NOT NULL foreign key
B
As a nullable foreign key to Member, because a book may have no borrower
C
As a primary key
D
As a composite key
Explanation
A book on the shelf has no borrower, so BorrowerID must allow nulls to represent the optional link.
Last verified on 27-11-2026
650 Which SQL is correct to add a foreign key to an existing Orders table?
A
CREATE FOREIGN KEY Orders.CustomerID;
B
ALTER TABLE Orders ADD PRIMARY KEY (CustomerID);
C
ALTER TABLE Orders ADD CONSTRAINT fk_customer FOREIGN KEY (CustomerID) REFERENCES Customer(CustomerID);
D
ALTER TABLE Customer ADD FOREIGN KEY (CustomerID);
Explanation
ALTER TABLE with ADD CONSTRAINT defines a named foreign key on the existing table, pointing to the parent table and column.
Last verified on 27-11-2026