MCQ Bank
What does the method getHeaderName() of HTTPServletResponse return if no header exists with the specified name?
- A) false
- B) An empty string
- C) undefined
- D) null
Which of the following is NOT a use of JSP directives?
- A) To include content from other resources
- B) To specify page settings
- C) To define the appearance of HTML tags
- D) To specify custom-tag libraries
At servlet service stage, webserver invokes __________ method.
- A) svltServices()
- B) serviceSvlt()
- C) servletServices()
- D) services()
Request and response of servlet are handled at _________ stage.
- A) destroy
- B) failure
- C) initialize
- D) service
Which parameter does getHeaderName() method of HTTPServletResponse accept?
- A) A boolean
- B) An integer
- C) A double
- D) A String
In JSP, ____________ is an implicit object, which belongs to ServletConfig class and represents the JSP configuration options.
- A) Config
- B) PageContext
- C) Application
- D) Session
In include type of request dispatcher, the first servlet which received request is also responsible to __________ .
- A) finish response
- B) show exceptions
- C) forward request
- D) modify request
The business layer in Java applications is responsible for:
- A) Implementing business logic and processing rules
- B) Managing the application's database connectivity
- C) Storing and retrieving data from persistent storage
- D) Handling user interface rendering and event handling
Which of the following tag is used to define initialization parameters value of a servlet?
- A) <parameter-value> </parameter-value>
- B) <param-value> </param-value>
- C) <initparam-value> </initparam-value>
- D) <para-value> </para-value>
Normally web applications are partitioned into _______ logical layers.
- A) One
- B) Four
- C) Two
- D) Three
What does getHeaderName("User-Agent") return if the "User-Agent" header exists and its value is "Mozilla/5.0"?
- A) Mozilla/5.0
- B) true
- C) An empty string
- D) null
Which of the following is not an HttpServletRequest method?
- A) setProtocol()
- B) getProtocol()
- C) getMethod()
- D) setAttribute(String, Object)
In the context of Session Tracking, states are maintained by the mutual cooperation of both client & __________.
- A) User
- B) Browser
- C) Server
- D) Customer
During different sessions, getServletContext() method provides ____________ ServletContext object/s to ____________ Servlets.
- A) different, same
- B) different, different
- C) same, same
- D) same , different
At servlet initialization stage, webserver invokes __________ method.
- A) initialize()
- B) init()
- C) initServelt()
- D) servletInit()
What is the correct syntax to create a Cookie object in Java?
- A) Cookie myCookie = new Cookie("name", "value");
- B) Cookie myCookie = Cookie.createCookie();
- C) Cookie myCookie = new Cookie();
- D) Cookie myCookie = createCookie("name", "value");