400+ Java Interview Questions and Answers blog

400+ Java Interview Questions and Answers blog


The pre Java Interview online written test questions that I hate

Posted: 18 Dec 2012 01:28 PM PST

Some online assessment sites basically try to test your memorizing capabilities with API based questions listed below. Also, about 30% - 50% of the questions are on API that you rarely use or obsolete. When you have the API documentation, why remember the API. Here are a few such questions I came across recently. If you want to ask such questions, then allow people to refer to the online API documentation. These tests are only going to filter out quality candidates.


Q. Which of the following are valid JavaMail message types?

a) Message.RecipientType.CC
b) MessageRecipientType.CC
c) Message.RecipientType.CCList
d) Message.RecipientType.BCC
e) MessageRecipientType.BCC

A. a and d


Q. Which of the following are JNDI event listeners?

a) NamespaceChangeListener
b) ObjectListener
c) ObjectChangeListener
d) UnsolicitedNotificationListener
e) ObjectNotFoundListenr

A. a, c, and d.


Q. Which of the following statements are correct, based on the following code snippet for uploading a file?

<form action="upload"  enctype="multipart/form-data">      <input type="text" name="description" />      <input type="file" name="file" />      <input type="submit" />  </form>  


a) The enctype must be "text/form-data"
b) The method attribute is missing in the "form" element and it should be of type "GET"
c) The method attribute is missing in the "form" element and it should be of type "POST"
d) The "input" element must have the attribute "value"
e) The above syntax is correct

A. c. 

The correct format is:

<form action="upload"  method="post" enctype="multipart/form-data">      <input type="text" name="description" />      <input type="file" name="file" />      <input type="submit" />  </form>  


Q. Which of the following objects are NOT part of the JavaBean Activation Framework (JAF)?

a) DataSource
b) DataFileHandler
c) DataHandler
d) DataContentHandler
e) FileDateHandler
f) FileTypeMap

A. b and e. All the others are part of JAF.


Q. Which of the following statements are INCORRECT?

a) HttpServletRequest.getRemoteUser( ) return null;
b) HttpServletRequest.isUserInRole(java.lang.String role) throws SecurityException ;
c) HttpServletRequest.getRemoteUser( ) return false;
d) HttpServletRequest.isUserInRole(java.lang.String role) return false;
e) HttpServletRequest.getUserPrincipal( ) throws SecurityException
f) HttpServletRequest.getUserPrincipal( ) return null;


A. b, c, and e are INCORRECT.

Q. Which of the following elements would you see in a SOAP payload with attachments?

a) <soap:header>
b) <soap:footer>
c) <soap:body>
d) <soap:content>
e) <soap:attachment>

A. a and c.


Q. Which of the following can be used in place of "****" in the code snippet shown below?


if(request.getParameter("location").equals("nextPage") {          *****    }    

a) request.sendRedirect("url");
b) response.sendRedirect("url");
c) request.redirect("url");
d) response.redirect("url");
e) response.send("url")


A.b

Q. Which of the following are valid JDBC  result set types?


a) TYPE_FORWARD_ONLY
b) TYPE_BACKWARD_ONLY
c) TYPE_SCROLL_INSENSITIVE
d) TYPE_SCROLL_SENSITIVE
e) TYPE_SCROLL_REVERSE

A. a, c, and d.


Q. Which of the following are valid JSP life cycle methods?

a) jspService( )
b)_jspService( )
c) jspInit( )
d) jspDestroy( )
e) _jspInit()

A. a, c, and d.


Q. Which of the following are CORRECT about JCA?

a)  JCA is a standard architecture for integrating heterogeneous EIS systems not written in Java
b)  JCA is a standard architecture for integrating other JEE systems
c)  JCA can be used to integrate with mainframe systems
d)  JCA can be used to integrate with ERP systems
e)  JCA can be used to integrate with Database systems
f)  The underlying EIS systems are integrated using pluggable resource adapters

A. a, c, d, e and f.

Q. Which of the following are INCORRECT about JAAS?

a) JAAS bring in location based authentication and authorization to JEE.
b) JAAS is designed to bring subject based authentication and authorization to JEE
c) JAAS is modeled after the Pluggable Authentication Module (PAM)-a popular API for defining authentication modules in a portable and extensible manner
d) JAAS can be used across managed resources such as servlet/JSP, EJB, or MBeans and over a variety of connection protocols such as HTTP, RMI/IIOP, or JMX/RMI.
e) JAAS was fully integrated into the core Java security architecture

A. a.

The last 2 questions are not bad, but for most of the other questions, the answers can be found by jumping on a search engine for 5 to 15 minutes. It is not really testing your understanding of the core concepts or hands-on experience.

Is it just me, or do you agree with me? Please post the Java Interview Questions that you hate.



Post a Comment