Java Test Questions Set 13

1)   Which is a mechanism where one object acquires all the properties and behaviors of the parent object?

a. Inheritance
b. Encapsulation
c. Polymorphism
d. None of the above
Answer  Explanation 

ANSWER: Inheritance

Explanation:
No explanation is available for this question!


2)    Java Virtual Machine is platform independent.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


3)   What is the range of the int data type?

a. –2,147,483,648 to 2,147,483,647
b. -2,147,483,647 to 2,147,483,648
c. -32,768 to 32,767
d. -32,767 to 32,768
Answer  Explanation 

ANSWER: –2,147,483,648 to 2,147,483,647

Explanation:
No explanation is available for this question!


4)   Which are subclasses of FilterInputStream and FilterOutputStream?

a. PipedInputStream
b. PipedOutputStream
c. DataInputStream
d. DataOutputStream
e. Both C & D
Answer  Explanation 

ANSWER: Both C & D

Explanation:
No explanation is available for this question!


5)   Which method returns a reference to the currently executing thread object?

a. currentThread()
b. runningThread()
c. runnableThread()
d. None of the above
Answer  Explanation 

ANSWER: currentThread()

Explanation:
No explanation is available for this question!


6)   If you import a package, subpackages will not be imported.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


7)   Which keyword is used to make the classes and interface of another package accessible to the current package?


a. Import
b. Implements
c. Instanceof
d. None of the above
Answer  Explanation 

ANSWER: Import

Explanation:
No explanation is available for this question!


8)   Which access specifiers can be used for a class so that it’s members can be accessed by a different class in the different package?

a. Private
b. Public
c. Protected
d. None of the above
Answer  Explanation 

ANSWER: Public

Explanation:
No explanation is available for this question!


9)   The Object class is not a parent class of all the classes in java by default.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


10)   Which is a superclass of all exception classes?

a. Throwable
b. Exception
c. RuntimeException
d. IOException
Answer  Explanation 

ANSWER: Throwable

Explanation:
No explanation is available for this question!


11)   The performance of the application will be faster if you use PreparedStatement interface because query is compiled only once.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


12)   Which method is used to send the same request and response objects to another servlet in RequestDispacher ?

a. forward()
b. sendRedirect()
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: forward()

Explanation:
No explanation is available for this question!


13)   Servlets handle multiple simultaneous requests by using threads.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


14)   Web server is used for loading the init() method of servlet.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


15)   What is used to display the intermediate result in an interceptor?

a. Params Interceptor
b. Custom Interceptor
c. ExecAndWait Interceptor
d. Prepare Interceptor
Answer  Explanation 

ANSWER: ExecAndWait Interceptor

Explanation:
No explanation is available for this question!


16)   The workflow interceptor is used to get information about the error messages defined in the action class.


a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


17)   EJB is like COM, Abbreviate the term COM?

a. Component Object Model
b. Component Oriented Model
c. Common Object Model
d. Common Oriented Model
Answer  Explanation 

ANSWER: Component Object Model

Explanation:
No explanation is available for this question!


18)   EJB is a specification for J2EE server, not a product; Java beans may be a graphical component in IDE.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


19)   Which package is used for Remote Method Invocation (RMI)?

a. java.lang.rmi
b. java.lang.reflect
c. java.applet
d. java.rmi
Answer  Explanation 

ANSWER: java.rmi

Explanation:
No explanation is available for this question!


20)   RMI is a server-side component; It is not required to be deployed on the server.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


21)   JavaServer Pages often serve the same purpose as programs implemented using the Common Gateway Interface (CGI)

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


22)   How many jsp implicit objects are there and these objects are created by the web container that are available to all the jsp pages?

a. 8
b. 9
c. 10
d. 7
Answer  Explanation 

ANSWER: 9

Explanation:
No explanation is available for this question!


23)   JSPs eventually are compiled into Java servlets, you can do as much with JSPs as you can do with Java servlets.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


24)   The ResultSet.next method is used to move to the next row of the ResultSet, making it the current row.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


25)    Drivers that are JDBC Compliant should normally support scrollable result sets, but they are not required to do so.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!