Software Engineering II MCQs with Answers
Practice important Software Engineering II MCQs with answers and explanations.
Chapter: 42
Q1201:
In refactoring, observable behavior must _______.
A. Change slightly
B. Remain unchanged
C. Improve
D. Double
Correct Answer:
B
Chapter: 42
Q1202:
What refactoring technique is demonstrated by consolidating duplicate code in conditional branches?
A. Extract Method
B. Consolidate Duplicate Conditional Fragments
C. Move Method
D. Replace Temp with Query
Correct Answer:
B
Chapter: 42
Q1203:
In the provided example, which function was called from different places leading to duplication?
A. receive()
B. calculate()
C. send()
D. total()
Correct Answer:
C
Chapter: 42
Q1204:
After refactoring duplicate conditional fragments, where was the send() function placed?
A. Inside if block
B. Inside else block
C. Outside if-else block
D. Removed completely
Correct Answer:
C
Chapter: 42
Q1205:
What factor values were used in the price calculation example?
A. 0.90 and 0.85
B. 0.95 and 0.98
C. 1.0 and 0.95
D. 0.99 and 0.91
Correct Answer:
B
Chapter: 42
Q1206:
Refactoring is compared to _______ according to the philosophy "if it stinks, change it".
A. Smells
B. Bugs
C. Warnings
D. Errors
Correct Answer:
A
Chapter: 42
Q1207:
Which of the following is NOT a type of "Bad Smell" in code?
A. Duplicated Code
B. Long Method
C. Well-Organized Classes
D. Large Class
Correct Answer:
C
Chapter: 42
Q1208:
Which "bad smell" involves methods needing lots of information from another class?
A. Data Clumps
B. Feature Envy
C. Shotgun Surgery
D. Lazy Class
Correct Answer:
B
Chapter: 42
Q1209:
Which bad smell is characterized by an object having temporary attributes?
A. Temporary Field
B. Lazy Class
C. Shotgun Surgery
D. Divergent Change
Correct Answer:
A
Chapter: 42
Q1210:
When a class delegates most of its responsibilities to another class, it is called _______.
A. Data Class
B. Incomplete Library Class
C. Middle Man
D. Speculative Generality
Correct Answer:
C
Chapter: 42
Q1211:
Long methods are considered a bad smell because they are _______.
A. Easy to maintain
B. Hard to understand
C. Fast to run
D. Very reusable
Correct Answer:
B
Chapter: 42
Q1212:
A large class reduces _______ in the system.
A. Cohesion
B. Coupling
C. Abstraction
D. Polymorphism
Correct Answer:
A
Chapter: 42
Q1213:
Which of the following is a symptom of Parallel Inheritance Hierarchies?
A. Duplicate comments
B. Adding subclasses in all hierarchies
C. Too many methods
D. Lack of classes
Correct Answer:
B
Chapter: 42
Q1214:
Shotgun Surgery refers to _______.
A. Making one change in one place
B. Making changes in many places
C. Adding a new class
D. Deleting a file
Correct Answer:
B
Chapter: 42
Q1215:
_______ is an obsession with using primitive types instead of classes.
A. Data Clumps
B. Primitive Obsession
C. Feature Envy
D. Middle Man
Correct Answer:
B
Chapter: 42
Q1216:
Which technique can replace switch statements according to refactoring suggestions?
A. Polymorphism
B. Inheritance
C. Encapsulation
D. Data Clumping
Correct Answer:
A
Chapter: 42
Q1217:
Lazy Class means a class that _______.
A. Works too much
B. Has too many functions
C. Doesn’t justify its existence
D. Has only private methods
Correct Answer:
C
Chapter: 42
Q1218:
Comments are sometimes used to _______ bad code.
A. Improve
B. Hide
C. Highlight
D. Correct
Correct Answer:
B
Chapter: 42
Q1219:
Which function in the code example finds the minimum value in an array?
A. minimum()
B. swap()
C. sort()
D. find()
Correct Answer:
A
Chapter: 42
Q1220:
The selection sort algorithm was improved by introducing _______.
A. Arrays
B. Classes
C. Functions
D. Inheritance
Correct Answer:
C