Mastering the Coding Interview: 8 Java Web Interview Questions for Java Developers
Hello, I'm going to share 31 questions that can help you to be prepared for an Interview, and not only that but also some important things we should know while we are coding.
These questions are divided into 3 sections, basics, advanced, and web. Today we'll talk about Java web questions.
PS: I'm not going to show you in-depth answers, if you haven't mastered some of these questions, I would recommend studying them more.
Java Web
1. About REST, what are the main methods and their differences?
Answer: POST, DELETE, GET, PUT, PATCH You should know the difference and when to use them.
REST is an essential skill for Web developers, I’ve shared 5 things I wanted to know about REST API when I was starting.
2. What is a JWT(Json web token)?
Answer: JWT is a token that contains and transmits information about a particular user or session. JWT is separated into 3 parts, Header (signature algorithm), Payload (claims, user data), and Signature (security guarantee)
3. What is Idempotent?
Answer: A request method is considered "idempotent" if the intended effect on the server of multiple identical requests with that method is the same as the effect for a single request of that type. Of the request methods defined by this specification, PUT, DELETE, and secure request methods are idempotent. According to RFC9110.
4. Do you know Richardson's Maturity Model, or what is Hypermedia Controls?
Answer: A model (developed by Leonard Richardson) that breaks down the principal elements of a REST approach into three steps. These introduce resources, HTTP verbs, and hypermedia controls. Hypermedia is the last level.
5. Do you know what is XSS, and how to prevent it?
Answer: Cross Site Scripting (XSS) can occur on the malicious script executed on the client side. Avoid allowing any type of JavaScript in the content of the application, and include a good CORs configuration. If you don't know about CORs(Cross-origin resource sharing), I would recommend studying it.
6. What is Contexts and Dependency Injection (CDI)?
Answer: The ability to inject components into an application in a typesafe way, including the ability to choose at deployment time which implementation of a particular interface to inject.
7. What is Spring Bean?
Answer: By definition, a Spring bean is an object that forms the backbone of your application and that is managed by the Spring IoC( Inversion of Control) container. A bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container. This question can be made differently, asking about IoC, so be aware of it.
8. What is the difference between Jakarta EE and Spring?
Answer: Spring is a framework and Jakarta EE is the specification.
Conclusion
Congratulations, if you reach here, this means that you have learned 31 possible questions for the interview. Of course, each interviewer can ask different things, and in different ways, so being prepared to live code, code challenges, code review, and other types is crucial to increase your chances.
Knowing these 31 questions can not only help you to be better during interviews but also help you to develop better solutions and become more productive.
I hope this can help you, and if you have another question, please share it here in the comments.