Sail E0 Webinar

MCQs

Total Questions : 20 | Page 1 of 2 pages
Question 1. Which of the following code is used to get an attribute in a HTTP Session object in servlets?
  1.    session.getAttribute(String name)
  2.    session.alterAttribute(String name)
  3.    session.updateAttribute(String name)
  4.    session.setAttribute(String name)
 Discuss Question
Answer: Option A. -> session.getAttribute(String name)




Question 2. Which method is used to specify before any lines that uses the PintWriter?
  1.    setPageType()
  2.    setContextType()
  3.    setContentType()
  4.    setResponseType()
 Discuss Question
Answer: Option C. -> setContentType()




Question 3. What are the functions of Servlet container?
  1.    Lifecycle management
  2.    Communication support
  3.    Multithreading support
  4.    All of the above
 Discuss Question
Answer: Option D. -> All of the above




Question 4. What is bytecode?
  1.    Machine-specific code
  2.    Java code
  3.    Machine-independent code
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> Machine-independent code




Question 5. Which object of HttpSession can be used to view and manipulate information about a session?
  1.    session identifier
  2.    creation time
  3.    last accessed time
  4.    All mentioned above
 Discuss Question
Answer: Option D. -> All mentioned above




Question 6. Which of the following statements are correct about the status of the Http response.
  1.    A status of 200 to 299 signifies that the request was successful
  2.    A status of 300 to 399 are informational messages
  3.    A status of 400 to 499 indicates an error in the server
  4.    A status of 500 to 599 indicates an error in the client
 Discuss Question
Answer: Option C. -> A status of 400 to 499 indicates an error in the server




Question 7. Which of the following is true about servlets?
  1.    Servlets execute within the address space of web server
  2.    Servlets are platform-independent because they are written in java
  3.    Servlets can use the full functionality of the Java class libraries
  4.    Servlets execute within the address space of web server, platform independent and uses the functionality of java class libraries
 Discuss Question
Answer: Option D. -> Servlets execute within the address space of web server, platform independent and uses the functionality of java class libraries




Question 8. Which JDBC driver Type(s) can be used in either applet or servlet code?
  1.    Both Type 1 and Type 2
  2.    Both Type 1 and Type 3
  3.    Both Type 3 and Type 4
  4.    Type 4 only
 Discuss Question
Answer: Option C. -> Both Type 3 and Type 4




Question 9. Which of the following code retrieves the MIME type of the body of the request?
  1.    new MimeType()
  2.    request.getContentType()
  3.    response.getContentType()
  4.    None of the above
 Discuss Question
Answer: Option B. -> request.getContentType()




Question 10. Which methods are used to bind the objects on HttpSession instance and get the objects?
  1.    setAttribute
  2.    getAttribute
  3.    Both A & B
  4.    None of the above
 Discuss Question
Answer: Option C. -> Both A & B




Latest Videos

Latest Test Papers