MCQ Questions on Computer Science Concepts
- To create an LRU (Least Recently Used) cache, which data structure is best suited?
A) Stack
B) Queue
C) HashMap + Doubly Linked List
D) Binary Search Tree - How long does it take to find an element in a balanced binary search tree?
A) O(1)
B) O(log n)
C) O(n)
D) O(n log n) - With a worst-case time complexity of O(n^2), which sorting method is stable?
A) Quick Sort
B) Merge Sort
C) Heap Sort
D) Bubble Sort - When it comes to object-oriented programming, which of the following is NOT true?
A) Encapsulation
B) Inheritance
C) Recursion
D) Polymorphism - Which SQL command eliminates every record—including all spaces allotted to the records—from a table?
A) DELETE
B) DROP
C) TRUNCATE
D) REMOVE - What is the output of the following code snippet?
int x = 5; System.out.println(x++);
A) 5
B) 6
C) 4
D) Error - Regarding a hash table, which of the following is accurate?
A) It always maintains the order of insertion
B) It allows duplicate keys
C) It provides average-case O(1) lookup time
D) It is implemented using a stack - Which of these databases is NOT NoSQL?
A) MongoDB
B) Cassandra
C) MySQL
D) Redis - When determining the shortest path in a weighted graph with non-negative weights, which algorithm is frequently used?
A) Prim’s Algorithm
B) Dijkstra’s Algorithm
C) Kruskal’s Algorithm
D) Bellman-Ford Algorithm - What is a legitimate method for avoiding a deadlock?
A) Allow circular wait
B) Use a single lock for all resources
C) Ignore resource allocation
D) Increase the number of processes - Which of these HTTP methods is NOT valid?
A) GET
B) POST
C) FETCH
D) PUT - To guarantee atomicity in database transactions, which of the following is employed?
A) Indexes
B) Triggers
C) Locks
D) Views - Regarding recursion, which of the following statements is accurate?
A) It always uses less memory than iteration
B) It can lead to a stack overflow if not properly controlled
C) It is always faster than iteration
D) It cannot be used for tree traversal - In Java, which of the following is NOT an acceptable access modifier?
A) public
B) private
C) protected
D) internal - What is the drawback of using arrays instead of linked lists?
A) Arrays have O(1) access time
B) Arrays have a fixed size
C) Arrays use more memory
D) Arrays are slower to traverse - Regarding RESTful APIs, which of the following statements is accurate?
A) They use the SOAP protocol
B) They are stateless
C) They require an XML data format
D) They cannot use HTTP - Out of the following, which is NOT a TCP protocol feature?
A) Connection-oriented
B) Reliable data transfer
C) Packet switching
D) Unreliable delivery - Which of the following describes how Python handles exceptions?
A) try-except
B) if-else
C) switch-case
D) for-while - In terms of time complexity, which of the following is NOT a valid Big O notation?
A) O(n²)
B) O(log n)
C) O(n!)
D) O(n^n!) - Regarding the stack data structure, which of the following statements is accurate?
A) Follows the FIFO principle
B) Follows the LIFO principle
C) Allows random access
D) Is always implemented using arrays - In Java, which of the following methods for creating a thread is NOT acceptable?
A) Extending the Thread class
B) Implementing the Runnable interface
C) Using the Callable interface
D) Using the Observer interface - Which of the following describes a min-heap’s characteristics?
A) The largest element is at the root
B) The smallest element is at the root
C) All leaves are at the same level
D) It is always a complete binary tree - In SQL, which of the following join types is NOT acceptable?
A) INNER JOIN
B) OUTER JOIN
C) CROSS JOIN
D) SIDE JOIN - In a relational database table, which of the following is used to uniquely identify a record?
A) Foreign key
B) Primary key
C) Index
D) View - What is NOT a legitimate method of preventing SQL injection?
A) Using prepared statements
B) Escaping user input
C) Using stored procedures
D) Concatenating user input directly into queries - Regarding the OSI model, which of the following statements is accurate?
A) It has 5 layers
B) The transport layer is responsible for routing
C) The application layer is the topmost layer
D) The physical layer is above the data link layer - Of the following, which is NOT a legitimate feature of a binary search tree?
A) The left child is less than the parent
B) The right child is greater than the parent.
C) No duplicate values
D) All nodes have two children - Which technique is applied to enhance database query performance?
A) Triggers
B) Indexes
C) Views
D) Constraints - Out of the following, which is NOT a legitimate use case for a linked list?
A) Implementing a stack
B) Implementing a queue
C) Random access of elements
D) Dynamic memory allocation - Regarding the Singleton design pattern, which of the following statements is accurate?
A) It allows multiple instances of a class
B) It restricts instantiation to one object
C) It is used for inheritance
D) It is not thread-safe
Answers
- C) HashMap + Doubly Linked List
- B) O(log n)
- D) Bubble Sort
- C) Recursion
- C) TRUNCATE
- A) 5
- C) It provides average-case O(1) lookup time
- C) MySQL
- B) Dijkstra’s Algorithm
- B) Use a single lock for all resources
- C) FETCH
- C) Locks
- B) It can lead to a stack overflow if not properly controlled
- D) internal
- B) Arrays have a fixed size
- B) They are stateless
- D) Unreliable delivery
- A) try-except
- D) O(n^n!)
- B) Follows the LIFO principle
- D) Using the Observer interface
- B) The smallest element is at the root
- D) SIDE JOIN
- B) Primary key
- D) Concatenating user input directly into queries
- C) The application layer is the topmost layer
- D) All nodes have two children
- B) Indexes
- C) Random access of elements
- B) It restricts instantiation to one object
Thank you for taking this quiz! Reviewing your responses and comprehending the rationale behind them will help you develop your computer science basics and boost your confidence in employment interviews. Continue to practice, expand your knowledge, and challenge yourself with new questions to stay sharp and interview-ready!
Subscribe to Our YouTube Channel to Get Latest Videos on IT Tutorials, MCQs and Quizzes.






