WorksheetsServlet Wipro
Total questions: 15
Worksheet time: 8mins
Which file in a Maven project defines dependencies, plugins, and build configuration?
Given a pom.xml, what will happen if a dependency is defined with <scope>provided</scope>?
It will be packaged in the final JAR/WAR.
Maven will fetch and include it from repository.
It is required only during runtime.
It won’t be packaged, assuming it’s provided by the runtime/container.
You use a plugin in pom.xml but Maven throws "MojoExecutionException". What’s likely missing?
JDK
Plugin dependency
Classpath
Maven repository
Which of the following goals is not a part of the Maven build lifecycle?
validate
package
deploy
merge
What happens if you forget to declare <groupId> in your dependency?
It’s optional
Build fails
Maven assumes “default” group
Compilation succeeds but runtime fails
You have this snippet in pom.xml:
What is its purpose?
Downloads Java 11
Configures Maven to use JDK 11 for compiling
Specifies JVM version at runtime
Which of the following servlet code snippets will lead to a thread-safety issue?
This servlet is thread-safe
Only causes issue if counter is static
Not thread-safe, as counter is shared among threads
Will throw compilation error
What is the correct order of lifecycle methods in a servlet?
Consider the following web.xml snippet. What does it do?
Loads servlet lazily
Loads servlet only when mapped URL is hit
Loads servlet eagerly at startup
Prevents servlet from being initialized
In the doPost() method, if you don't set the content type before writing, what can happen?
Response is blocked
Browser displays garbled content
Servlet gets restarted
No issue at all
Which method is never called by the servlet container?
Constructor of servlet with parameters
Which HTTP response status code best represents "Resource created"?
201
200
204
302
What happens if you call sendRedirect("page.jsp") after response.getWriter().write("Hello")?
Redirect will occur
Output will be Hello and redirect will happen
IllegalStateException will occur
It will flush and stop the servlet
In Servlet 3.0 annotations, which annotation is used to define a servlet?
Which element is mandatory in a Maven pom.xml?
<name>
<description>
<version>
<url>
