Web Applications Quiz - Languages Java
Free practice quiz: Web Applications (Languages Java). 57 multiple-choice questions with answers and explanations. Play online, no sign-up needed.
This Languages Java practice quiz has 57 multiple-choice questions on Web Applications, and 57 of them come with an explanation. Try the 5 sample questions below (tap an option to check yourself), then play the full quiz online. No sign-up needed.
Start quiz: 57 questions, freeSample questions
Which of the following is NOT a core technology used in building dynamic web applications?
Show answer
Answer: D. SQL
HTML, CSS, and JavaScript are fundamental client-side technologies for creating the structure, style, and interactivity of web pages. SQL (Structured Query Language) is primarily used for managing and querying relational databases, which are often used by web applications, but it's not a core client-side or server-side *programming* technology for building the application's logic itself.
What is the difference between a Servlet and a JSP?
Show answer
Answer: A. Servlets are for logic, JSPs are for presentation; JSPs compile into Servlets.
Servlets are Java code that are good for handling business logic and request processing. JSPs are HTML-like documents with embedded Java code, designed for easier presentation of dynamic content. The JSP container typically translates and compiles JSPs into servlets.
What is the concept of 'stateless' in the context of RESTful web services?
Show answer
Answer: A. Each request from a client to the server must contain all the information necessary to understand and complete the request.
In a stateless architecture, the server does not store any client context between requests. This improves scalability and reliability as any server can handle any request.
What is the difference between `RequestDispatcher.forward()` and `HttpServletResponse.sendRedirect()` in Java Servlets?
Show answer
Answer: B. forward() transfers control to another resource within the same server (server-side) without the client's knowledge; sendRedirect() instructs the client's browser to make a new request to a different URL.
`forward()` is an internal server-side operation that keeps the original request. `sendRedirect()` involves a client-side round trip, sending a 302 status code to the browser, which then initiates a new request.
What is a common use case for Java Mail API?
Show answer
Answer: A. Sending emails from a web application.
The Java Mail API provides a platform-independent, protocol-independent framework for sending and receiving emails, commonly used in web applications for notifications, account verification, etc.
More questions in this quiz
Answers and explanations are in the full quiz.
- In the context of Java web applications, what does a Servlet do?
- What is the primary role of the JavaServer Pages (JSP) technology?
- Which of the following describes the Model-View-Controller (MVC) architectural pattern commonly used in Java web frameworks?
- What is the purpose of a `web.xml` file in a Java web application?
- Which Java API is primarily used for handling HTTP requests and responses in web applications?
- What is the primary function of a Filter in a Java web application?
- In Java web applications, what is the purpose of a Listener?
- Which of the following is a popular Java-based web framework that implements the MVC pattern?
- What is the role of a web container (e.g., Tomcat, Jetty) in a Java web application?
- What is the primary goal of using a framework like Spring Boot for Java web applications?
- What does the acronym REST stand for in the context of web services?
- Which HTTP method is typically used to retrieve data from a server in a RESTful web service?
- What is the purpose of a cookie in web applications?
- What is the role of the `HttpSession` object in Java web applications?
- Which technology is used for client-side templating and dynamic UI updates in modern Java web applications, often in conjunction with server-side frameworks?
- What is the primary benefit of using a framework like Spring Security for Java web applications?
- What is a common use case for JavaServer Faces (JSF)?
- What is the purpose of the `ServletContext` object in a Java web application?
- Which of the following is a client-side technology that can be used to enhance the interactivity of Java web applications?
- What is the primary role of a Java Web Framework (e.g., Spring MVC, Struts, JSF)?
- Which component is responsible for translating JSP pages into Java Servlets?
- What is a common way to manage database connections efficiently in a Java web application?
- In a typical Java web application, what is the role of an ORM (Object-Relational Mapping) tool like Hibernate?
- What is the significance of `request.getParameter()` in a Java Servlet?
- What is the difference between `GET` and `POST` HTTP methods for web requests?
- What is a Java Bean in the context of web applications?
- What is the primary purpose of the `web.forge.xml` (or `web.xml`) file in a WAR (Web Application Archive) file?
- What is the role of a Java Web Start application?
- Which HTTP status code indicates that a request was successful?
- What is a 'tag library' in the context of JSPs?
- What is the purpose of a `FilterChain` in the context of Java Servlet Filters?
- What is Spring WebFlux?
- What is the purpose of the `Content-Type` header in an HTTP request or response?
- What does `servletContext.setAttribute()` do?
- Which Java specification defines the API for creating and managing sessions in web applications?
- What is the purpose of a `DispatcherServlet` in Spring MVC?
- What is `application/json` commonly used for in web APIs?
- What is a WebSocket in the context of web applications?
- What does the term 'idempotent' mean for HTTP methods?
- What is the purpose of the `FilterConfig` object in a Java Servlet Filter?
- What is a CSRF (Cross-Site Request Forgery) attack in web applications?
- What is the purpose of the `@WebServlet` annotation in modern Java web applications?
- What is the primary goal of using AJAX (Asynchronous JavaScript and XML) in web applications?
- In the context of Spring MVC, what is a Controller's main responsibility?
- What is a common security vulnerability in web applications related to input validation?
- What is the role of a Maven or Gradle plugin for web applications?
- What is the purpose of the `Content-Length` HTTP header?
- What is the main advantage of using a framework like Spring MVC over writing raw Servlets and JSPs for complex web applications?
- What is the primary function of a `HttpServletRequest` object in a Java Servlet?
- What is the purpose of the `HttpServletResponse` object in a Java Servlet?
- What is the 'same-origin policy' in web browsers?
- What is the role of a JSP tag file?
More quizzes
- Collections▶ Play
- JVM Internals▶ Play
- Memory Management▶ Play
- Syntax▶ Play
- Threads and Concurrency▶ Play