Page: 5
Unit-1: The Servlet Technology Model
Q 18. You are creating a servlet that generates stock market graphs. You want to provide the web browser with precise information about the amount of data being sent in the response stream. Which two HttpServletResponse methods will you use to provide this information? (Choose two.) A. response.setLength(numberOfBytes); B. response.setContentLength(numberOfBytes); C. response.setHeader("Length", numberOfBytes); D. response.setIntHeader("Length", numberOfBytes); E. response.setHeader("Content-Length", numberOfBytes); F. response.setIntHeader("Content-Length", numberOfBytes); Q19. Which two prevent a servlet from handling requests? (Choose two.) A. The servlet's init method returns a non-zero status. B. The servlet's init method throws a ServletException. C. The servlet's init method sets the ServletResponse's content length to 0. D. The servlet's init method sets the ServletResponse's content type to null. E. The servlet's init method does NOT return within a time period defined by the servlet container. Q20 . Which of the following HTTP methods is used to remove an article from a virtual shopping cart in a Web application? [Select one correct answer ] A. GET B. HEAD C. TRACE D. POST E. CONNECT F. PUT Q21 Consider the following code segment: <HTML> <BODY> <FORM ACTION=’/ servlet/postQuery’ > <p>Enter the file name you want to post</p> <INPUT TYPE=`text’ name=’ resourceName’ size=’22 ‘ > <input type =’submit’ > </ p> </FORM> </ BODY> </ HTML Which request method will be invoked? [Select one correct answer] A. PUT B. HEAD C. POST D. TRACE E. GET Q22 Which of the following statements are true? [ Select all correct answer] - A GET request is supposed to change the state of the server.
- A POST request can be bookmarked
- POST is the default HTTP method
- A GET request can handle limited data size.
- Request parameters submitted via a GET request get appended to the URL
Q23 Which character is used to separate the URI and query string in a GET request? [ select one Answer] A. & B. ? C. + D. = Q24. Consider the following code fragment taken from an HTML page: < FORM ACTION=http://www.tatamcgrawhill.com/servlet/Post FromDataServlet”> Which method do you need to override of the HttpServlet class inside the PostFormDataServlets class? - void doPost(HttpServletRequest req, HttpServletResponse rest)
- void doPost(ServletRequest req, ServletResponse rest)
- void doGet(HttpServletsRequest req, HttpServletsResponse rest)
- void doPut(HttpServletsRequest req, HttpServletResponse rest)
- void doConnect (ServletsRequest req, ServletResponse rest)
Get Answers For All Questions
Page: 5
1
2
3
4
5
6
7
8
9
|