Java Test Questions Set 1

1)   JDBC is a Java API that is used to connect and execute query to the database

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


2)   Which result set generally does not show changes to the underlying database that are made while it is open. The membership, order, and column values of rows are typically fixed when the result set is created?

a. TYPE_FORWARD_ONLY
b. TYPE_SCROLL_INSENSITIVE
c. TYPE_SCROLL_SENSITIVE
d. ALL MENTIONED ABOVE
Answer  Explanation 

ANSWER: TYPE_SCROLL_INSENSITIVE

Explanation:
No explanation is available for this question!


3)   Servlet technology is used to create web application

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


4)   How many layers are available in Hibernate architecture?

a. 3
b. 4
c. 5
d. 2
Answer  Explanation 

ANSWER: 3

Explanation:
No explanation is available for this question!


5)   In which technology Struts 2 provides various types of tags such as UI tags, Data tags, control tags etc. to ease the development of struts 2 application?

a. Various Result support
b. Integration Support
c. Various Tag support
d. Theme and Template support
Answer  Explanation 

ANSWER: Various Tag support

Explanation:
No explanation is available for this question!


6)   EJB technology is built on the top of Socket Programming

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


7)   RMI allows an object to invoke methods on an object running in another JVM

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


8)   JSP’s provide better facilities for separation of page code and template data by mean of Java beans, EJBs and custom tag libraries

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


9)   Which is a perfect example of runtime polymorphism?

a. Method overloading
b. Method overriding
c. Constructor overloading
d. None of the above
Answer  Explanation 

ANSWER: Method overriding

Explanation:
No explanation is available for this question!


10)   Which specification that provides runtime environment in which java byte code can be executed?

a. JDK
b. JVM
c. JRE
d. None of the above
Answer  Explanation 

ANSWER: JVM

Explanation:
No explanation is available for this question!


11)   Which is commonly used method of ByteArrayOutputStream class?

a. ByteArrayOutputStream()
b. ByteArrayOutputStream(int size)
c. public synchronized void writeTo(OutputStream out) throws IOException
d. Both A & B
Answer  Explanation 

ANSWER: public synchronized void writeTo(OutputStream out) throws IOException

Explanation:
No explanation is available for this question!


12)   Thread class constructor allocates a new thread object

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


13)   Which of the package is used to enable interaction with garbage collector?

a. java.lang.ref
b. java.lang.reflect
c. java.lang
d. java.awt
Answer  Explanation 

ANSWER: java.lang.ref

Explanation:
No explanation is available for this question!


14)   The clone() method is defined in?

a. Abstract class
b. Object Class
c. ArrayList class
d. None of the above
Answer  Explanation 

ANSWER: Object Class

Explanation:
No explanation is available for this question!


15)   Where are these five keywords try, catch, finally, throw, and throws used in?

a. Exception Handling
b. String Handling
c. Event Handling
d. None of the above
Answer  Explanation 

ANSWER: Exception Handling

Explanation:
No explanation is available for this question!


16)   The life cycle of the thread is controlled by ?



a. JVM
b. JDK
c. JRE
d. None of the above
Answer  Explanation 

ANSWER: JVM

Explanation:
No explanation is available for this question!


17)   In which the access modifier means that the field can be accessed by all classes in your application?

a. private
b. Public
c. Package
d. Protected
Answer  Explanation 

ANSWER: Public

Explanation:
No explanation is available for this question!


18)   java.applet defines how many interfaces?

a. 2
b. 3
c. 4
d. 5
Answer  Explanation 

ANSWER: 3

Explanation:
No explanation is available for this question!


19)   The ActionListener interface is not used for handling action events

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


20)   The wrapper classes are part of the which package, that is imported by default into all Java programs?

a. java.lang
b. java.awt
c. java.io
d. java.util
Answer  Explanation 

ANSWER: java.lang

Explanation:
No explanation is available for this question!


21)   In InetAddress class which method returns the host name of the IP Address?

a. public String getHostName()
b. public String getHostAddress()
c. public static InetAddress getLocalHost()
d. None of the above
Answer  Explanation 

ANSWER: public String getHostName()

Explanation:
No explanation is available for this question!


22)   Which steps occur when establishing a TCP connection between two computers using sockets?

a. The server instantiates a ServerSocket object, denoting which port number communication is to occur on
b. The server invokes the accept() method of the ServerSocket class. This method waits until a client connects to the server on the given port
c. After the server is waiting, a client instantiates a Socket object, specifying the server name and port number to connect to
d. All of the above
Answer  Explanation 

ANSWER: All of the above

Explanation:
No explanation is available for this question!


23)   In XML document comments are given as?

a. < !-- --!>
b. < !-- ?
c. < /-- -->
d. < ?-- ?
Answer  Explanation 

ANSWER: < !-- ?

Explanation:
No explanation is available for this question!


24)   XML is designed to carry data, and to display data

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


25)   XML attribute values must always be enclosed in quotes

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!