JavaRocks

SCWCD

Question 31

Which method is used to store file in the server ?  
 
     A    GET
     B    PUT
     C    POST
     D    HEAD

Answer
B
A PUT method is used to store a file or data in the server. The request URI identifies the location in the server to store the file.

 

Question 32

When a user clicks on a link in a page, which method will get invoked ?  
     A    POST    
     B    PUT       
     C    GET       
     D    HEAD

Answer
CWhen the user types the request URL into the browser's location field or clicks on a hyperlink, the GET method is triggered. When the user submits the form with the method attribute as "GET" or without any method attribute, then also GET will invoked.

 

Question 33

What method will get executed on clicking the following code.? 
<form method="GET" action="/TestServlet">
        <input type="text" name="name">
        <input type="submit" value="Submit">
</form>  
 
     A    GET
     B    POST
     C    HEAD        
     D    PUT

Answer
A

 

Question 34

Which character is used to separate the URI and query string ?  
     A    ?
     B    &
     C    =
     D    ;

Answer
A
Choice A is correct. ? is used to separate the URI and query string. & is used to separate the name value pairs from each other.

 

Question 35

What will be the output of the following code? Assume that all the variables are declared properly
String str= request.getDateHeader("Accept-Language");
out.println(str);  
 
     A    Compiler error
     B    An IO Exception is thrown
     C    Null
     D    An IllegalArgumentException thrown

Answer
D
Answer D is the correct choice. If the header value cannot converted to date , then an IllegalArgumentException will be thrown. Since  the header value is a String, it will throw the IllegalArgumentException.

 

Previous        Next