BCS Bachelor of Computer Science Degree 2 — Questions and Answers
Question 1: Which sorting algorithm has an average-case time complexity of O(n log n) and uses a pivot element to partition arrays?
- Merge Sort
- Quick Sort (Correct answer)
- Heap Sort
- Bubble Sort
Correct answer: Quick Sort
Quick Sort uses a pivot to partition the array and achieves O(n log n) average-case time complexity.
Question 2: In a relational database, which normal form eliminates transitive dependencies?
- First Normal Form (1NF)
- Second Normal Form (2NF)
- Third Normal Form (3NF) (Correct answer)
- Boyce-Codd Normal Form (BCNF)
Correct answer: Third Normal Form (3NF)
Third Normal Form (3NF) requires that no non-key attribute is transitively dependent on the primary key.
Question 3: What does the acronym REST stand for in the context of web services?
- Remote Execution State Transfer
- Representational State Transfer (Correct answer)
- Resource Encapsulation Standard Template
- Responsive End-to-end Service Technology
Correct answer: Representational State Transfer
REST stands for Representational State Transfer, an architectural style for distributed hypermedia systems.
Question 4: In the OSI model, which layer is responsible for end-to-end communication and error recovery?
- Network Layer
- Data Link Layer
- Transport Layer (Correct answer)
- Session Layer
Correct answer: Transport Layer
The Transport Layer (Layer 4) handles end-to-end communication, error recovery, and flow control.
Question 5: Which design pattern ensures a class has only one instance and provides a global access point to it?
- Factory Pattern
- Observer Pattern
- Singleton Pattern (Correct answer)
- Decorator Pattern
Correct answer: Singleton Pattern
The Singleton pattern restricts instantiation of a class to a single object and provides global access to it.
Question 6: In machine learning, what technique is used to prevent overfitting by randomly dropping neurons during training?
- Batch Normalization
- Dropout (Correct answer)
- L2 Regularization
- Early Stopping
Correct answer: Dropout
Dropout randomly deactivates neurons during training to prevent the network from becoming too dependent on specific pathways.
Question 7: Which data structure uses LIFO (Last In, First Out) ordering?
- Queue
- Deque
- Stack (Correct answer)
- Priority Queue
Correct answer: Stack
A Stack follows LIFO ordering where the last element inserted is the first to be removed.
Which sorting algorithm has an average-case time complexity of O(n log n) and uses a pivot element to partition arrays?