Software Engineering Basic Software Engineering 3 — Questions and Answers
Question 1: Which type of testing verifies that individual components of a software application work correctly in isolation?
- Integration testing
- System testing
- Unit testing (Correct answer)
- Acceptance testing
Correct answer: Unit testing
Unit testing focuses on verifying the smallest testable parts of an application independently from the rest of the system.
Question 2: What is a 'race condition' in concurrent software?
- A performance benchmark comparing two algorithms
- A bug that occurs when the outcome depends on the unpredictable timing of multiple threads (Correct answer)
- A scheduling algorithm that prioritizes faster processes
- A deadlock between two competing processes
Correct answer: A bug that occurs when the outcome depends on the unpredictable timing of multiple threads
A race condition occurs when two or more threads access shared data simultaneously and the result depends on which one executes first.
Question 3: In software architecture, what does 'loose coupling' mean?
- Components are tightly integrated and share internal state
- Components have minimal dependencies on each other, making them easier to change independently (Correct answer)
- The system uses weak data types throughout
- Services communicate only through shared memory
Correct answer: Components have minimal dependencies on each other, making them easier to change independently
Loose coupling reduces dependencies between components so that changes in one component have minimal impact on others.
Question 4: What is the role of a 'build system' in software development?
- Managing team communication and task assignment
- Automating the compilation, linking, and packaging of source code into deployable artifacts (Correct answer)
- Tracking bugs and feature requests
- Providing a code editor with syntax highlighting
Correct answer: Automating the compilation, linking, and packaging of source code into deployable artifacts
A build system automates transforming source code into executable programs, including compilation, dependency resolution, and packaging.
Question 5: Which SOLID principle states that a class should have only one reason to change?
- Open/Closed Principle
- Liskov Substitution Principle
- Single Responsibility Principle (Correct answer)
- Interface Segregation Principle
Correct answer: Single Responsibility Principle
The Single Responsibility Principle (SRP) dictates that a class should encapsulate only one concern, so only one type of change would require it to be modified.
Question 6: What is a 'stub' in the context of software testing?
- A tool that measures test coverage
- A minimal fake implementation of a dependency used to isolate the unit under test (Correct answer)
- A bug reported by end users
- A placeholder comment in source code
Correct answer: A minimal fake implementation of a dependency used to isolate the unit under test
A stub replaces a real dependency with a simplified version that returns predefined data, allowing testing without invoking the actual component.
Question 7: What does 'refactoring' mean in software development?
- Adding new features to an existing codebase
- Restructuring existing code without changing its external behavior to improve readability or performance (Correct answer)
- Fixing bugs identified during QA testing
- Migrating a codebase to a new programming language
Correct answer: Restructuring existing code without changing its external behavior to improve readability or performance
Refactoring improves the internal structure of code while preserving its observable behavior, reducing complexity and technical debt.
Which type of testing verifies that individual components of a software application work correctly in isolation?