Showing 21–30 of 309 questions
Which data structure is best for implementing a priority queue in heapsort algorithm?
A
Stack
B
Queue
C
Heap
D
Array
EXPLANATION
A heap (min-heap or max-heap) efficiently supports priority queue operations with O(log n) insertion and deletion.
In database indexing, which structure provides O(log n) search complexity?
A
Linear search
B
B-Tree
C
Hash table with collision
D
Linked list
Correct Answer:
B. B-Tree
EXPLANATION
B-Tree maintains balanced structure ensuring O(log n) search, insert, and delete operations, commonly used in databases.
Which SQL JOIN returns only matching records from both tables?
A
INNER JOIN
B
LEFT JOIN
C
RIGHT JOIN
D
FULL OUTER JOIN
Correct Answer:
A. INNER JOIN
EXPLANATION
INNER JOIN returns only the records that have matching values in both tables, filtering out non-matching rows.
Which cryptographic algorithm is currently recommended by NIST for symmetric encryption?
A
DES (Data Encryption Standard)
B
AES (Advanced Encryption Standard)
C
MD5
D
SHA-1
Correct Answer:
B. AES (Advanced Encryption Standard)
EXPLANATION
AES is the current NIST standard for symmetric encryption with key sizes of 128, 192, or 256 bits. DES is deprecated due to weak key size.
What is the correct order of operations for the Big O notation from least to most complex?
A
O(1) < O(n) < O(n²) < O(2ⁿ) < O(n!)
B
O(n!) < O(2ⁿ) < O(n²) < O(n) < O(1)
C
O(n) < O(1) < O(n²) < O(2ⁿ) < O(n!)
D
O(log n) > O(1) > O(n) > O(n²)
Correct Answer:
A. O(1) < O(n) < O(n²) < O(2ⁿ) < O(n!)
EXPLANATION
Constant O(1) is fastest, followed by logarithmic O(log n), linear O(n), quadratic O(n²), exponential O(2ⁿ), and factorial O(n!) which is slowest.
In operating systems, what is a deadlock?
A
When a process terminates unexpectedly
B
When two or more processes are blocked, each waiting for resources held by the other
C
When memory is exhausted
D
When the CPU stops functioning
Correct Answer:
B. When two or more processes are blocked, each waiting for resources held by the other
EXPLANATION
Deadlock is a situation where multiple processes cannot proceed because each holds resources needed by others, creating a circular wait condition.
What is the primary advantage of using MongoDB (NoSQL) over traditional relational databases?
A
It provides ACID compliance on all operations
B
It has flexible schema that accommodates unstructured data and horizontal scalability
C
It uses SQL for all queries
D
It requires less storage space
Correct Answer:
B. It has flexible schema that accommodates unstructured data and horizontal scalability
EXPLANATION
MongoDB's document-based model allows flexible schemas for unstructured data and supports horizontal scaling, unlike rigid relational schemas.
In machine learning, what does overfitting mean?
A
The model is too simple to learn patterns
B
The model learns training data too well, including noise, reducing generalization to new data
C
The model has too many layers
D
The model requires more training data
Correct Answer:
B. The model learns training data too well, including noise, reducing generalization to new data
EXPLANATION
Overfitting occurs when a model learns the training data including its noise and irregularities, performing poorly on unseen test data.
Which of the following best describes a graph data structure with no cycles?
A
Directed Graph
B
Tree
C
Complete Graph
D
Bipartite Graph
EXPLANATION
A tree is a special case of a graph with no cycles. It has n nodes and n-1 edges, forming a hierarchical structure.
What is the purpose of the COMMIT statement in SQL transactions?
A
To undo all pending changes
B
To save all changes made during a transaction permanently to the database
C
To create a new transaction
D
To delete committed records
Correct Answer:
B. To save all changes made during a transaction permanently to the database
EXPLANATION
COMMIT saves all changes made during the current transaction to the database permanently. Until COMMIT, changes can be rolled back using ROLLBACK.