Thursday, August 6, 2015

Volante Freshers JAVA Previous Questions

2015 & 2016 Batch Freshers Registration Link

1. Which of these interface abstractes the output of messages from httpd?
a) LogMessage
b) LogResponse
c) Httpdserver
d) httpdResponse
View Answer
Answer: a
Explanation: LogMessage is a simple interface that is used to abstract the output of messages from the httpd.

2015 & 2016 Batch Freshers Registration Link

2. Which of these class is used to create servers that listen for either local or remote client programs?
a) httpServer
b) ServerSockets
c) MimeHeader
d) HttpResponse
View Answer
Answer: b
Explanation: None.

3. Which of these is a standard for communicating multimedia content over email?
a) http
b) https
c) Mime
d) httpd
View Answer
Answer: c
Explanation: MIME is an internet standard for communicating multimedia content over email. The HTTP protocol uses and extends the notion of MIME headers to pass attribute pairs between HTTP client and server.

4. Which of these methods is used to make raw MIME formatted string?
a) parse()
b) toString()
c) getString()
d) parseString()
View Answer
Answer: a
Explanation: None.

5. Which of these class is used for operating on request from the client to the server?
a) http
b) httpDecoder
c) httpConnection
d) httpd
View Answer
Answer: d
Explanation: None.

6. Which of these method of MimeHeader is used to return the string equivalent of the values stores on MimeHeader?
a) string()
b) toString()
c) convertString()
d) getString()
View Answer

Answer:b
Explanation: toString() does the reverse of parse() method, it is used to return the string equivalent of the values stores on MimeHeader.

8. Which of these is an instance variable of class httpd?
a) port
b) cache
c) log
d) All of the mentioned
View Answer
Answer: d
Explanation: There are 5 instance variables : port, docRoot, log, cache and stopFlag. All of them are private.

9. Which of these is an instance variable of httpd that is a Hashtable?
a) port
b) cache
c) log
d) stopFlag
View Answer
Answer: c
Explanation: cache is the Hashtable where all of the files are cached in RAM and is initialized when the object is created.

5. 
What will be the output of the program?
public class RTExcept 
{
    public static void throwit () 
    {
        System.out.print("throwit ");
        throw new RuntimeException();
    }
    public static void main(String [] args) 
    {
        try 
        {
            System.out.print("hello ");
            throwit();
        }
        catch (Exception re ) 
        {
            System.out.print("caught ");
        }
        finally 
        {
            System.out.print("finally ");
        }
        System.out.println("after ");
    }
}
[A].hello throwit caught
[B].Compilation fails
[C].hello throwit RuntimeException caught after
[D].
hello throwit caught finally after@
Answer: Option D
Explanation:
The main() method properly catches and handles the RuntimeException in the catch block, finally runs (as it always does), and then the code returns to normal.
A, B and C are incorrect based on the program logic described above. Remember that properly handled exceptions do not cause the program to stop executing.