Computer Knowledge — Database/SQL
Aptitude · Reasoning · English · CS — Corporate & Campus Interview Prep
50 Questions 5 Topics Take Test
Advertisement
Showing 1–10 of 50 questions in Database/SQL
Q.1 Medium Database/SQL
Which data structure is best suited for implementing a priority queue?
A Stack
B Queue
C Heap
D Linked List
Correct Answer:  C. Heap
Explanation:

A heap (binary heap) efficiently implements priority queues with O(log n) insertion and deletion of minimum/maximum elements.

Take Test
Q.2 Medium Database/SQL
In SQL, what is the difference between INNER JOIN and LEFT JOIN?
A INNER JOIN returns all rows; LEFT JOIN returns only matching rows
B INNER JOIN returns only matching rows; LEFT JOIN returns all rows from left table
C Both are identical in functionality
D INNER JOIN is faster than LEFT JOIN always
Correct Answer:  B. INNER JOIN returns only matching rows; LEFT JOIN returns all rows from left table
Explanation:

INNER JOIN returns only rows with matches in both tables. LEFT JOIN returns all rows from the left table plus matching rows from the right table.

Take Test
Q.3 Medium Database/SQL
Which cloud service model provides virtualized computing resources over the internet?
A SaaS (Software as a Service)
B IaaS (Infrastructure as a Service)
C PaaS (Platform as a Service)
D DaaS (Database as a Service)
Correct Answer:  B. IaaS (Infrastructure as a Service)
Explanation:

IaaS provides infrastructure resources (compute, storage, networking). SaaS provides applications, PaaS provides development platforms.

Take Test
Q.4 Medium Database/SQL
What is the primary purpose of database indexing?
A Increase storage space
B Improve query performance
C Reduce security vulnerabilities
D Eliminate data redundancy
Correct Answer:  B. Improve query performance
Explanation:

Indexes speed up data retrieval by creating optimized lookup structures, reducing the number of disk accesses needed to find data.

Take Test
Q.5 Medium Database/SQL
In cybersecurity, what does encryption primarily protect against?
A Physical theft of devices
B SQL injection attacks
C Unauthorized access to data during transmission
D Database schema changes
Correct Answer:  C. Unauthorized access to data during transmission
Explanation:

Encryption converts data into unreadable format, protecting it from unauthorized access during transmission and storage.

Take Test
Advertisement
Q.6 Medium Database/SQL
Which sorting algorithm has the best average-case time complexity?
A Bubble Sort - O(n²)
B Merge Sort - O(n log n)
C Insertion Sort - O(n²)
D Selection Sort - O(n²)
Correct Answer:  B. Merge Sort - O(n log n)
Explanation:

Merge Sort and Quick Sort have O(n log n) average complexity. Merge Sort guarantees this; Quick Sort can degrade to O(n²) in worst case.

Take Test
Q.7 Medium Database/SQL
What is the primary function of a query optimizer in a DBMS?
A Compile SQL queries into machine code
B Determine the most efficient execution plan for queries
C Encrypt sensitive data in queries
D Validate SQL syntax errors
Correct Answer:  B. Determine the most efficient execution plan for queries
Explanation:

The query optimizer analyzes different execution strategies and selects the one with minimal resource consumption and execution time.

Take Test
Q.8 Medium Database/SQL
In machine learning basics, what is the purpose of training data in AI models?
A To test the final model accuracy
B To teach the model patterns and make predictions
C To validate model security
D To encrypt sensitive information
Correct Answer:  B. To teach the model patterns and make predictions
Explanation:

Training data is used to teach AI models to recognize patterns. Test data evaluates accuracy; validation data prevents overfitting.

Take Test
Q.9 Medium Database/SQL
Which data structure is best suited for implementing a LRU (Least Recently Used) cache?
A Hash Map + Doubly Linked List
B Single Array
C Binary Search Tree
D Queue 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.

Take Test
Q.10 Medium Database/SQL
Which normalization form eliminates transitive dependencies?
A Third Normal Form (3NF)
B Second Normal Form (2NF)
C First Normal Form (1NF)
D Boyce-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.

Take Test
IGET
iget AI
Online · Ask anything about exams
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips