Java Test Questions Set 9

1)   An abstract class has no use when it is extended by some other class.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


2)   Which provides a new way for your programs to interface with code libraries written in other languages?

a. JNI
b. JDBC
c. RMI
d. GUI
Answer  Explanation 

ANSWER: JNI

Explanation:
No explanation is available for this question!


3)   Which classes has Sun Microsystem suggested not to use for read and write the textual information?

a. BufferedInputStream and BufferedOutputStream
b. SequenceInputStream and SequenceOutputStream
c. FileInputStream and FileOutputStream
d. Both A & B
Answer  Explanation 

ANSWER: FileInputStream and FileOutputStream

Explanation:
No explanation is available for this question!


4)   Can we start a thread twice?

a. Yes
b. No


Answer  Explanation 

ANSWER: No

Explanation:
No explanation is available for this question!


5)   Who is also called father of Java Programming Language?

a. James Gosling
b. Ken Thompson
c. Dennis Richie
d. None of the above
Answer  Explanation 

ANSWER: James Gosling

Explanation:
No explanation is available for this question!


6)   Which string function returns the number of characters in a string?

a. length()
b. replace()
c. charAt()
d. equalIgnoreCase()
Answer  Explanation 

ANSWER: length()

Explanation:
No explanation is available for this question!


7)   Which default exception handler that performs the following tasks:

- Prints out exception description.
- Prints the stack trace (Hierarchy of methods where the exception occurred).
- Causes the program to terminate.


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

ANSWER: JVM

Explanation:
No explanation is available for this question!


8)   What is the disadvantage of Garbage Collection?

a. It makes java memory efficient because garbage collector removes the unreferenced objects from heap memory
b. It is automatically done by the garbage collector so we don't need to make extra efforts
c. None of the above

Answer  Explanation 

ANSWER: None of the above

Explanation:
No explanation is available for this question!


9)   A class is declared inside a class but outside a method it is known as ________.

a. Anonymous Inner class
b. Member Inner class
c. Local Inner class
d. Static nested class
Answer  Explanation 

ANSWER: Member Inner class

Explanation:
No explanation is available for this question!


10)   Which method of 'Class' class is used to register the driver class and the method is used to dynamically load the driver class?

a. forName()
b. getConnection()
c. createStatement()
d. executeQuery()
Answer  Explanation 

ANSWER: forName()

Explanation:
No explanation is available for this question!


11)   Which object is created by the web container at time of deploying the project?

a. ServletConfig
b. ServletContext
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: ServletContext

Explanation:
No explanation is available for this question!


12)   We need to specify @Inheritance(strategy=InheritanceType.JOINED) in the parent class and @PrimaryKeyJoinColumn annotation in the subclasses.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


13)   Which way will the architecture and flow of struts 2 application will go to understand the struts flow?

a. Basic
b. Standard
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Both A & B

Explanation:
No explanation is available for this question!


14)   Which component does the Entity bean represents the persistent data stored in the database?

a. Server-side component
b. Client-side component
c. server and client side component
d. None of the above
Answer  Explanation 

ANSWER: Server-side component

Explanation:
No explanation is available for this question!


15)   Which method in naming class specifies a name to the remote object?

a. bind(string name)
b. rebind(string name)
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: bind(string name)

Explanation:
No explanation is available for this question!


16)   A bean encapsulates many objects into one object, so we can access this object from multiple places.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


17)   Which class has traditionally been the backbone of the JDBC architecture?

a. the JDBC driver manager
b. the JDBC driver test suite
c. the JDBC-ODBC bridge
d. All mentioned above
Answer  Explanation 

ANSWER: the JDBC driver manager

Explanation:
No explanation is available for this question!


18)   Which is the correct order of lifecycle in an applet?

a. Applet is started,initialized,painted,destroyed,stopped
b. Applet is painted,started,stopped,initilaized,destroyed
c. Applet is initialized,started,painted,stopped,destroyed
d. None of the above
Answer  Explanation 

ANSWER: Applet is initialized,started,painted,stopped,destroyed

Explanation:
No explanation is available for this question!


19)   The following
a) It is lightweight.
b) It supports pluggable look and feel.
c) It follows MVC (Model View Controller) architecture
are the advantages of _____ .


a. Swing
b. AWT
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Swing

Explanation:
No explanation is available for this question!


20)   Which method returns an enumeration of the values contained in the dictionary?

a. Enumeration elements()
b. Enumeration keys()
c. Enumeration propertyNames()
d. None of the above
Answer  Explanation 

ANSWER: Enumeration elements()

Explanation:
No explanation is available for this question!


21)   Which class is used to create servers that listen for either local client or remote client programs?

a. ServerSockets
b. httpServer
c. httpResponse
d. None of the above
Answer  Explanation 

ANSWER: ServerSockets

Explanation:
No explanation is available for this question!


22)   URL stands for Uniform Resource Locator and represents a resource on the World Wide Web, such as a Web page or FTP directory.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


23)   XML is ?

a. Platform Independent
b. Language Independent
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Both A & B

Explanation:
No explanation is available for this question!


24)   The following example shows which XML Syntax rule,
< note date=" 12/11/2007">
< to>Tove< /to>
< from>Jani< /from>
< /note>


a. XML Attribute Values Must be Quoted
b. All XML Elements Must Have a Closing Tag
c. XML Tags are Case Sensitive
d. XML Elements Must be Properly Nested
Answer  Explanation 

ANSWER: XML Attribute Values Must be Quoted

Explanation:
No explanation is available for this question!


25)   The getElementsByTagName() method is used to retrieve data from an XML document.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!