B CompE Bachelor of Computer Engineering Software Engineering 2 — Questions and Answers
Question 1: Which software metric measures the number of independent paths through a program's source code?
- Lines of Code (LOC)
- Cyclomatic Complexity (Correct answer)
- Code Coverage
- Function Point
Correct answer: Cyclomatic Complexity
Cyclomatic complexity measures the number of linearly independent paths through a program, indicating testing effort and code complexity.
Question 2: What is the primary goal of refactoring in software development?
- Add new features to the software
- Improve internal code structure without changing external behavior (Correct answer)
- Fix bugs discovered during testing
- Increase execution speed of the program
Correct answer: Improve internal code structure without changing external behavior
Refactoring restructures existing code to improve readability and maintainability without altering its observable behavior.
Question 3: Which design pattern ensures only one instance of a class exists and provides a global access point?
- Factory Pattern
- Observer Pattern
- Singleton Pattern (Correct answer)
- Decorator Pattern
Correct answer: Singleton Pattern
The Singleton pattern restricts a class to a single instance and provides a global access point to that instance.
Question 4: What is the purpose of a software requirements specification (SRS) document?
- Describe the physical architecture of the system
- Provide a detailed description of the software's functions, performance, and constraints (Correct answer)
- Define the project schedule and budget
- Document post-deployment maintenance procedures
Correct answer: Provide a detailed description of the software's functions, performance, and constraints
An SRS document formally describes what a software system should do, serving as a contract between stakeholders and developers.
Question 5: Which version control system is most widely used for distributed source code management?
- CVS
- SVN
- Git (Correct answer)
- Mercurial
Correct answer: Git
Git is the most widely used distributed version control system, allowing every developer to have a full copy of the repository.
Question 6: What does 'black-box testing' mean in software testing?
- Testing internal code logic and structure
- Testing software functionality without knowledge of internal implementation (Correct answer)
- Testing only the database layer
- Testing in a production environment
Correct answer: Testing software functionality without knowledge of internal implementation
Black-box testing validates software functionality based on inputs and expected outputs without knowledge of the internal source code.
Which software metric measures the number of independent paths through a program's source code?