ICT Software Development Concepts 2 — Questions and Answers
Question 1: Which design pattern ensures a class has only one instance and provides a global access point to it?
- Factory
- Singleton (Correct answer)
- Observer
- Decorator
Correct answer: Singleton
The Singleton pattern restricts instantiation of a class to a single object and provides a static method to access it.
Question 2: In version control, what does 'rebasing' a branch accomplish?
- Merges two branches and creates a merge commit
- Moves or replays commits onto a new base commit (Correct answer)
- Deletes the branch history
- Creates a copy of the repository
Correct answer: Moves or replays commits onto a new base commit
Rebasing re-applies commits from one branch on top of another, resulting in a linear commit history.
Question 3: What is the primary purpose of a code linter?
- Compile source code into machine code
- Automatically deploy applications
- Analyze code for stylistic and programmatic errors (Correct answer)
- Encrypt source files for security
Correct answer: Analyze code for stylistic and programmatic errors
A linter statically analyzes code to flag programming errors, bugs, stylistic issues, and suspicious constructs.
Question 4: Which principle does the 'D' in SOLID stand for?
- Data Abstraction Principle
- Dependency Inversion Principle (Correct answer)
- Dynamic Dispatch Principle
- Declarative Syntax Principle
Correct answer: Dependency Inversion Principle
The Dependency Inversion Principle states that high-level modules should not depend on low-level modules; both should depend on abstractions.
Question 5: What does 'technical debt' refer to in software development?
- The financial cost of software licenses
- The accumulated cost of shortcuts and suboptimal code decisions (Correct answer)
- Server infrastructure expenses
- The time spent on documentation
Correct answer: The accumulated cost of shortcuts and suboptimal code decisions
Technical debt represents the future cost of rework required because quick, easy solutions were chosen over better long-term approaches.
Question 6: In a REST API, which HTTP method is idempotent and used to fully replace a resource?
- POST
- PATCH
- PUT (Correct answer)
- DELETE
Correct answer: PUT
PUT is idempotent and replaces the entire resource at the specified URI, while PATCH only partially updates it.
Question 7: What is 'pair programming' in agile development?
- Two separate developers working on the same feature independently
- Two developers sharing one workstation, collaborating on the same code simultaneously (Correct answer)
- A code review process where two reviewers approve each commit
- Running two versions of an application in parallel for testing
Correct answer: Two developers sharing one workstation, collaborating on the same code simultaneously
Pair programming has two developers sharing one workstation — one writes code (driver) while the other reviews in real time (navigator).
Which design pattern ensures a class has only one instance and provides a global access point to it?