You have created a piece of code that didn't work in production. You found the bug during testing, and nobody else is aware of it. What would you do next?
"Developing code and creating applications is a team effort involving many people and resources. Anytime something negative or positive occurs it has an impact on the entire team. This is why the best course of action when you find a bug is to inform the group. Being transparent enables you to use the rest of the team and other resources to develop a solution to the problem, while not creating an issue that may delay the development or impact the quality of the work. In software development, honesty is always the best policy."
While this appears to be an operational question, it is actually seeking to understand your level of integrity. There are several ways you can address this issue, but when answering the question be sure to respond in a manner that the company will find acceptable. As you probably have heard before there is the right way and there's an expedient way. While you might use the expedient way in real life, always answer a question like this in the right way.
"This has actually happened to me in one of my previous roles. I discovered a bug and knew it would take some effort to patch it. I could have probably done it without anybody noticing, however the time I spent correcting the mistake could have been used for more productive work. What I did was tell my manager and other project stakeholders about the bug and provide an estimate of how much time it would take to repair it. We discussed the impact on the rest of the project and decided to proceed, with complete transparency across the entire team. As it turned out, this had little impact on the overall project and we still finished on time and under budget."
