06.03 Designing Subroutines And Stubs - Quiz¶
Check your understanding
-
What is the main purpose of a method signature?
- To implement the method’s internal logic
- To define how other code can interact with the method { data-correct }
- To store the method’s variables
- To optimize the method’s performance
-
Which of the following makes a good method name?
process_data()calculate_student_grade_average(){ data-correct }do_stuff()method1()
-
What is a stub in programming?
- A complete method implementation
- A temporary method implementation focusing on interface rather than full logic { data-correct }
- A method that has been deleted
- A method that throws errors
-
When should you use stubs during development?
- Only when you can’t implement the real method
- To test class design before implementing everything { data-correct }
- Only for methods that will never be implemented
- When you want to make your code run slower
-
What should a good method signature include?
- Only the method name
- Method name, parameters, and clear documentation { data-correct }
- Just the return type
- Only complex parameter types
-
Which stub implementation is most helpful for testing?
-
What is the benefit of designing method signatures before implementing the full logic?
- It makes the code run faster
- It helps identify interface problems early { data-correct }
- It reduces the amount of code needed
- It eliminates the need for testing
-
In incremental development with stubs, what should you do first?
- Implement all methods completely
- Write comprehensive tests for every method
- Design clear method signatures and basic stub implementations { data-correct }
- Optimize the code for performance
-
Which principle should guide method design?
- Each method should do multiple different tasks
- Each method should focus on one specific task { data-correct }
- Methods should be as long as possible
- Method names should be abbreviated to save typing
-
What makes stub implementations valuable during development?
- They provide the final solution to all problems
- They allow testing of class design and integration before full implementation { data-correct }
- They eliminate the need for real implementations
- They automatically generate the final code