CS FundamentalsHardProduct-company MCQ pattern
Java's I/O library lets you write new BufferedReader(new InputStreamReader(socket.getInputStream())), each wrapper adding behaviour to the object it wraps while keeping a compatible interface. Which pattern is this?
- A. Decorator
- B. Composite
- C. Strategy
- D. Chain of Responsibility
Correct answer: A. Decorator
Decorator wraps an object to add responsibilities dynamically, and wrappers can be stacked. Composite builds part-whole trees; Strategy swaps algorithms.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- An age field accepts integers from 18 to 60 inclusive. Using equivalence partitioning only, what is the minimum number of test values…
- Counting each simple condition in a compound boolean expression as a separate decision, what is the cyclomatic complexity of this…
- A program's control flow graph has two separate connected components (for example, main and one called function drawn separately), with 14…
- How many of the following statements about cyclomatic complexity are correct? 1. It equals the number of linearly independent paths…
- A function has three integer inputs. How many test cases does worst-case boundary value analysis (every combination of min, min+, nom…
- main has commits A–B–C. Branch feature was created from B and has commits D–E. On feature you run git rebase main. How many of these…