In SQL, which JOIN returns only matching records from both tables?
AINNER JOIN
BLEFT JOIN
CFULL OUTER JOIN
DCROSS JOIN
Correct Answer:
A. INNER JOIN
Explanation:
INNER JOIN returns only rows with matching values in both tables. LEFT JOIN includes unmatched left table rows, FULL OUTER JOIN includes all rows, and CROSS JOIN produces Cartesian product.
Which data structure is best suited for implementing a LRU (Least Recently Used) cache?
AHash Map + Doubly Linked List
BSingle Array
CBinary Search Tree
DQueue only
Correct Answer:
A. Hash Map + Doubly Linked List
Explanation:
LRU cache requires O(1) access and O(1) removal/insertion of least-used items. Hash Map provides O(1) lookup, and Doubly Linked List maintains order efficiently.
Which normalization form eliminates transitive dependencies?
AThird Normal Form (3NF)
BSecond Normal Form (2NF)
CFirst Normal Form (1NF)
DBoyce-Codd Normal Form (BCNF)
Correct Answer:
A. Third Normal Form (3NF)
Explanation:
3NF removes transitive dependencies where non-key attributes depend on other non-key attributes. BCNF is stricter but 3NF eliminates transitive dependencies.
What is the primary purpose of database replication in distributed systems?
AImprove availability and fault tolerance
BIncrease query processing speed only
CReduce storage costs
DEliminate the need for backups
Correct Answer:
A. Improve availability and fault tolerance
Explanation:
Replication maintains copies across nodes for high availability, disaster recovery, and load distribution. It doesn't eliminate backups—they serve different purposes.
In cybersecurity, what is the primary purpose of a firewall?
AControl incoming and outgoing network traffic based on rules
BEncrypt all data transmitted
CDetect viruses and malware
DManage user authentication
Correct Answer:
A. Control incoming and outgoing network traffic based on rules
Explanation:
Firewalls filter traffic based on security policies. While they provide protection, encryption is separate, antivirus is different, and authentication is handled by other systems.
What does CAP theorem state in distributed systems?
AA system can guarantee at most 2 of 3: Consistency, Availability, Partition tolerance
BAll distributed systems must be Consistent, Available, and Partition-tolerant
CConsistency requires Availability and Partitions
DAvailability is always achieved in partitioned systems
Correct Answer:
A. A system can guarantee at most 2 of 3: Consistency, Availability, Partition tolerance
Explanation:
CAP theorem (Brewer's theorem) states distributed systems must choose 2 of 3 properties: strong consistency (C), continuous availability (A), or tolerance to network partitions (P).