Java MCQ Questions for Placement - Set 11

1)   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!


2)   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!


3)   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!


4)   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!


5)   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!


6)   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!


7)   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!


8)   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!


9)   Servlets handle multiple simultaneous requests by using threads.

a. True
b. False
Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


10)   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!


11)   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!


12)   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!


13)   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!


14)   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!


15)   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!


16)   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!


17)   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!


18)   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!


19)   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!


20)   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!


21)   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!


22)   An interface is a blueprint of a class. It has static constants and abstract methods.

a. True
b. False
Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


23)   Which variables are created when an object is created with the use of the keyword 'new' and destroyed when the object is destroyed?

a. Local variables
b. Instance variables
c. Class Variables
d. Static variables
Answer  Explanation 

ANSWER: Instance variables

Explanation:
No explanation is available for this question!


24)   Breaking a string or stream into meaningful independent words is known as tokenization.

a. True
b. False
Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


25)   What can be accessed or inherited without actual copy of code to each program?

a. Browser
b. Applet
c. Package
d. None of the above
Answer  Explanation 

ANSWER: Package

Explanation:
No explanation is available for this question!


26)   Which provides accessibility to classes and interface?

a. import
b. Static import
c. All the above
d. None of the above
Answer  Explanation 

ANSWER: import

Explanation:
No explanation is available for this question!


27)   If you are inserting any value in the wrong index as shown below, 1. int a[]=new int[5]; 2. a[10]=50; it would result in ______.

a. NullPointerException
b. ArrayIndexOutOfBoundsException
c. ArithmeticException
d. NumberFormatException
Answer  Explanation 

ANSWER: ArrayIndexOutOfBoundsException

Explanation:
No explanation is available for this question!


28)   Packages are used for distributing a collection of reusable classes, usually in a format known as Java Archive (JAR) file.

a. True
b. False
Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


29)   Which is used to call the stored procedures and functions?

a. CallableStatement Interface
b. PreparedStatement Interface
c. All the above
d. None of the above
Answer  Explanation 

ANSWER: CallableStatement Interface

Explanation:
No explanation is available for this question!


30)   Which interfaces provide methods for batch processing in JDBC?

a. java.sql.Statement
b. java.sql.PreparedStatement
c. All the above
d. None of the above
Answer  Explanation 

ANSWER: All the above

Explanation:
No explanation is available for this question!