BCS Bachelor of Computer Science Degree MCQ 4 ā Questions and Answers
Question 1: Which HTTP status code indicates that a requested resource was permanently moved?
- 200 OK
- 301 Moved Permanently (Correct answer)
- 404 Not Found
- 500 Internal Server Error
Correct answer: 301 Moved Permanently
HTTP 301 tells clients and search engines that the resource has permanently moved to a new URL.
Question 2: In graph theory, which algorithm finds the shortest path between all pairs of vertices?
- Dijkstra's Algorithm
- Bellman-Ford Algorithm
- Floyd-Warshall Algorithm (Correct answer)
- Prim's Algorithm
Correct answer: Floyd-Warshall Algorithm
Floyd-Warshall computes shortest paths between every pair of vertices in O(V³) using dynamic programming.
Question 3: What is the main advantage of using a hash table over a sorted array for lookups?
- Hash tables use less memory
- Hash tables support range queries efficiently
- Hash tables offer O(1) average-case lookup (Correct answer)
- Hash tables maintain sorted order automatically
Correct answer: Hash tables offer O(1) average-case lookup
Hash tables provide O(1) average-case time for insert, delete, and lookup by computing a direct index from the key.
Question 4: In software engineering, what does the term 'cohesion' refer to?
- The degree to which modules depend on each other
- The degree to which elements within a module belong together (Correct answer)
- The ability of a system to scale under load
- The process of combining multiple modules into one
Correct answer: The degree to which elements within a module belong together
Cohesion measures how closely related and focused the responsibilities of a single module or class are ā high cohesion is desirable.
Question 5: Which cryptographic concept ensures that a sender cannot deny sending a message?
- Confidentiality
- Integrity
- Non-repudiation (Correct answer)
- Availability
Correct answer: Non-repudiation
Non-repudiation uses digital signatures to provide proof of origin so a sender cannot later deny transmitting a message.
Question 6: What is the purpose of a foreign key in a relational database?
- To uniquely identify each row in a table
- To encrypt sensitive column values
- To enforce referential integrity between tables (Correct answer)
- To index frequently queried columns
Correct answer: To enforce referential integrity between tables
A foreign key enforces referential integrity by ensuring a value in one table corresponds to an existing primary key in another table.
Question 7: In operating systems, what is a race condition?
- A CPU scheduling algorithm that favors shorter jobs
- A situation where the outcome depends on unpredictable ordering of concurrent operations (Correct answer)
- A deadlock involving exactly two processes
- A memory leak caused by dangling pointers
Correct answer: A situation where the outcome depends on unpredictable ordering of concurrent operations
A race condition occurs when multiple threads or processes access shared data concurrently and the final result depends on execution order.
Which HTTP status code indicates that a requested resource was permanently moved?