BSCS Software Engineering Principles 2 — Questions and Answers
Question 1: Which design pattern ensures only one instance of a class exists?
- Factory
- Observer
- Singleton (Correct answer)
- Strategy
Correct answer: Singleton
The Singleton pattern restricts instantiation of a class to a single object, providing a global access point.
Question 2: What does cyclomatic complexity measure?
- Memory usage of a program
- Number of independent paths through code (Correct answer)
- Runtime performance
- Lines of code
Correct answer: Number of independent paths through code
Cyclomatic complexity counts the number of linearly independent paths through a program's source code.
Question 3: In Scrum, who is responsible for maximizing the value of the product?
- Scrum Master
- Development Team
- Product Owner (Correct answer)
- Stakeholder
Correct answer: Product Owner
The Product Owner owns the product backlog and prioritizes work to maximize value delivered.
Question 4: Which software metric measures the degree to which components depend on one another?
- Cohesion
- Coupling (Correct answer)
- Complexity
- Coverage
Correct answer: Coupling
Coupling measures how strongly one module depends on another; low coupling is desirable for maintainability.
Question 5: What is the primary purpose of a software requirements specification (SRS)?
- To document the source code
- To describe system behavior and constraints for stakeholders (Correct answer)
- To outline the test plan
- To specify the deployment environment
Correct answer: To describe system behavior and constraints for stakeholders
An SRS formally describes what a system shall do, serving as a contract between developers and stakeholders.
Question 6: Which refactoring operation extracts a piece of code into its own named method?
- Inline method
- Extract method (Correct answer)
- Move field
- Pull up method
Correct answer: Extract method
Extract Method takes a code fragment and turns it into a method with a descriptive name, improving readability.
Which design pattern ensures only one instance of a class exists?