TD Tutor
Long Method Quiz
Method Decomposition Techniques
Question
1
of 5
1
What is the main benefit of breaking long methods into smaller ones?
Easier debugging and testing
Better code organization
Reduced cognitive load
All of the above
Correct!
Incorrect. The correct answer is:
2
What metric best indicates a method is too long?
More than 20 lines
Performs multiple responsibilities
Contains nested conditionals
Takes more than 1 second to execute
Correct!
Incorrect. The correct answer is:
3
Which SOLID principle is most relevant to method extraction?
Single Responsibility Principle
Open/Closed Principle
Liskov Substitution
Interface Segregation
Correct!
Incorrect. The correct answer is:
4
What is the ideal maximum number of lines for a method according to most style guides?
5-10 lines
10-20 lines
20-30 lines
There is no universal rule
Correct!
Incorrect. The correct answer is:
5
Which refactoring technique is most appropriate for long methods?
Extract Method
Inline Method
Replace Conditional with Polymorphism
Introduce Parameter Object
Correct!
Incorrect. The correct answer is:
Previous
Next
Submit Quiz
Quiz Results
0
/5
Back to Tutorial