Select chapter



basics (7.papers)
constructors (1.papers)
packages (1.papers)
inheritance (7.papers)
misc (3.papers)
exceptions (5.papers)
threads (4.papers)
overloading (1.papers)
jsp (3.papers)
servlets (9.papers)
jdbc (2.papers)
util (1.papers)
xml (2.papers)
IO stream (3.papers)
Hide

Sponsored Links


  

java interview questions and answers

Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
6
How does the following statement work if we insert this in a doPost method of a servlet?
 if (true) {
      response.setHeader("Refresh", "5");
    }
  1. reload this page or go to the specified URL every 5 minutes
  2. reload this page or go to the specified URL every 5 seconds
  3. reload this page or go to the specified URL in 5 seconds
  4. None are correct
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
8
What is the tag that is used to represent pre-initialisation of the servlet in web.xml?
  1. There is no specific tag for pre-initialization
  2. <servlet> </servlet>
  3. <init> </init>
  4. <load-on-startup>1</load-on-startup>
    
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
11
Which of the following is a valid code to add Cookie to the Set-Cookie response header?
  1. Cookie cookie = new Cookie("user", "u1234");
    response.addCookie(cookie);
  2. Cookie cookie = new Cookie("user", "u1234");
    response.setCookie(cookie);
  3. Cookie cookie = new Cookie("user", "u1234");
    response.encodeURL(cookie);
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
14
Given a URL, what is the form data that is associated with a Get request?
  1. host/path?user=John+Mathews&company=skillgun&loc=Bangalore
  2. user=John+Mathews&company=skillgun&loc=Bangalore
  3. user=John+Mathews
  4. We can not identify form data from the given URL
Show Answer
Share Facebook gmail Twitter
15
What does the request header "User-Agent" specify?
  1. The MIME type of the browser
  2. The URL of the User/Client
  3. The type of browser
  4. The data attached by the client
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
17
What is the functionality of the given code?
import javax.servlet.http.*;

public class MySample extends Cookie {
  public static final int DURATION = 60*60*24*365;
  
  public MySample(String name, String value) {
    super(name, value);
    setMaxAge(DURATION);
  }
}
  1. It creates a Cookie that automatically persists when the client quits the browser
  2. It creates a cookie but fail to persist
  3. It creates a Cookie but can only be alive if the browser is active
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Read more papers :