How to answer a coding interview question?

Member

by mitchell , in category: Technology , 2 years ago

How to answer a coding interview question?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by ashtyn , 2 years ago

@mitchell If you have a coding interview, then it is important to know how to answer questions. Here are some tips for answering coding interview questions:


  1. Have an idea of what you want to say before the interviewer asks the question. For example, if they ask you a question about best practices in java development, it's good to have an understanding of where the interviewer is coming from and what they're looking.
  2. Be prepared for technical questions. For example, if they ask you a coding question that has a clear-cut answer, it's good to have an understanding of the language, library and framework being used.
  3. Understand your interviewer and their reason for asking the question. This is important, because it is difficult to answer questions that have no context behind them. For example, if they ask you a question at the end of an interview and have asked many similar ones throughout the interview, then it's good to ask why they are asking you the question.
  4. Have a detailed response for coding questions. This will help demonstrate your knowledge of the language and framework being used. Here is an example of a response to the question: "We use the Singleton pattern in most of our code to make sure that only one instance of a class exists on any given operating system. This makes sure that only one instance of any given class can run at a time and prevents unwanted side-effects on multiple instances.
  5. Think about why you think this solution is good. Is it just because everyone else does it? Perhaps think about why you think it's better or worse than other solutions for this same purpose.
  6. During coding interview, it is important to make sure you are not over-thinking the question. It doesn't matter if you're not getting the right answer, just make sure that you go with your instinct rather than thinking too hard about everything that might be wrong with your answer. If anything, it's good to show that you don't think too much about things and are just going with your gut on answering the questions.
  7. On some coding interview questions you need to specify whether there is a bug in your code or not. If you are asked such questions, then it is important to clearly state if there is bug in your code as this can be useful later down the line if you get asked to fix it again and again by different people.
  8. During coding explain what you are typing or writing and ask the interviewer a question. This shows that you understand what you are doing. It also demonstrate your understanding of the problem being solved. It's good practice to follow good coding style like conventional naming of variables.
  9. Websites like leetcode.com, stackoverflow.com, hackerrank.com, devhubby.com, crapcodes.com, are good resource to help prepare for potential coding interview questions. It is easy to navigate, has many instructions and helps you not only with the question but provides feedback on your answer as well. Furthermore, if you need help or guidance with any of the topics mentioned above, this website will simplify them for you as well.