Java Server and Servlet MCQ Questions
Java Server and Servlet MCQ Questions
1.
A.A Java program that runs on the server to handle client requests
2.
A.`handleRequest()`
B.`runServlet()`
C.`execute()`
D.`doGet()`
3.
4.
D.None of These
5.
6.
7.
Which HTTP method is typically used for retrieving data from a server in Java Servlets?
A.`GET`
B.`POST`
C.`PUT`
D.`DELETE`
8.
9.
10.
D.None of These
11.
12.
13.
14.
Which of the following is NOT a standard HTTP status code in Java Servlets?
B.`403 Forbidden`
C.`200 OK`
15.
D.None of These
17.
In Java Servlets, what is the purpose of the `doFilter()` method in the `Filter` interface?
18.
What is the purpose of the `context-param` element in the `web.xml` file of a Java web
application?
19.
Which Java package contains the core classes and interfaces for servlets?
A.`javax.servlet`
B.`java.beans`
C.`java.jdbc`
D.`java.db`
20.
Which HTTP method is used for updating data on the server in Java Servlets?
A.`GET`
B.`PUT`
C.`POST`
D.`DELETE`
22.
D.None of These
23.
What is the purpose of the `init-param` element in the `web.xml` file of a Java web application?
24.
D.Sessions can be tracked using cookies, URL rewriting, and hidden form fields
25.
26.
What is the primary function of the `destroy()` method in Java Servlets?
27.
C.To define a filter that can be applied to servlet requests and responses
28.
D.None of These
29.
30.
31.
B.run configuration
C.launch configuration
D.project configuration
32.
A.2048 MB
B.2048 bytes
C.4095 bytes
D.4095 MB
33.
Which of the following code is used to get an attribute in a HTTP Session object in servlets?
A.session.getAttribute(String name)
B.session.alterAttribute(String name)
C.session.updateAttribute(String name)
D.session.setAttribute(String name)
34.
How is the dynamic interception of requests and responses to transform the information done?
A.servlet container
B.servlet config
C.servlet context
D.servlet filter
35.
What is debugging an application which runs on another java virtual machine on another
machine?
A.virtual debugging
B.remote debugging
C.machine debugging
D.compiling debugging
36.
Which of the following code retrieves the body of the request as binary data?
A.DataInputStream data = new InputStream()
37.
Which key helps to step out of the caller of currently executed method?
A.F3
B.F5
C.F7
D.F8
38.
A.Vaadin
B.AngularJS
C.KendoUI
D.Springcore
39.
40.
A.input tag
B.inoutBufferedReader tag
C.meta tag
D.scanner tag
42.
A.jar
B.war
C.zip
43.
A.10.X.X.X
B.172.X.X.X
C.192.168.X.X
44.
Which of the below can be used to debug front end of a web application?
A.Junit
B.Fitnesse
C.Firebug
D.Mockito
45.
A.breakpoints
B.System.out.println
C.logger.log
D.logger.error
46.
A.HTTP
B.HTTPS
C.FTP
D.HTTP Tunneling
47.
Which component can be used for sending messages from one application to another?
A.server
B.client
C.mq
D.webapp
48.
Which method is used to get three-letter abbreviation for locale's country in servlets?
A.Request.getISO3Country()
B.Locale.getISO3Country()
C.Response.getISO3Country()
D.Local.retrieveISO3Country()
49.
D.PortOccupiedException is thrown
50.
A.True
B.False
51.
C.Servlets can use the full functionality of the Java class libraries
D.Servlets execute within the address space of web server, platform independent and uses the
functionality of java class libraries
52.
A.breakpoint view
B.variable view
C.debug view
D.logger view
53.
Which mode allows us to run program interactively while watching source code and variables
during execution?
A.safe mode
B.debug mode
D.exception mode
54.
A.hostReachable()
B.ping()
C.isReachable()
D.portBusy()
55.
A.Socket
B.ServerSocket
C.Server
D.ServerReader
56.
B.eclipse perspective
C.debug perspective
D.jdbc perspective
57.
A.Initialization
B.Constructor function
D.Setup() method
58.
59.
B.toad
C.JDBC template
D.mysql
60.
A.client
B.server
C.tomcat
D.applet
61.
Which of the below are common network protocols?
A.TCP
B.UDP
D.CNP
62.
A.stateless
B.stateful
C.transfer protocol
D.information protocol
63.
How to deep dive into the execution of a method from a method call?
A.F3
B.F5
C.F7
D.F8
64.
65.
66.
How does eclipse provide the capability for debugging browser actions?
67.
In CGI, process starts with each request and will initiate OS level process.
A.True
B.False
68.
A.The destroy() method is called only once at the end of the life cycle of a filter
B.The destroy() method is called after the filter has executed doFilter method
C.The destroy() method is called only once at the begining of the life cycle of a filter
69.
A.InetAddress
B.Address
C.IP Address
D.TCP Address
70.
B.UnknownHostException is thrown
C.IOException is thrown