Java Test Questions Set 7

1)   A final class is not to be inherited.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


2)   What is meant by JIT?

a. Java In Time
b. Just In Time
c. Join In Time
d. None of the above
Answer  Explanation 

ANSWER: Just In Time

Explanation:
No explanation is available for this question!


3)   From where the SequenceInputStream class is used to read data?

a. Single Stream
b. Multiple streams
c. Multilevel Streams
d. None of the above
Answer  Explanation 

ANSWER: Multiple streams

Explanation:
No explanation is available for this question!


4)   Which method in thread class causes the currently executing thread object to temporarily pause and allow other threads to execute?

a. public boolean isAlive()
b. public int getId()
c. public void yield()
d. public boolean isDaemon()
Answer  Explanation 

ANSWER: public void yield()

Explanation:
No explanation is available for this question!


5)   Which package is used for GUI?

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

ANSWER: java.awt

Explanation:
No explanation is available for this question!


6)   Which method causes the current thread to wait for the specified milliseconds, until the another thread notifies? (invokes notify() or notifyAll() method)?

a. public final void wait(long timeout)throws InterruptedException
b. protected void finalize()throws Throwable
c. public final void wait(long timeout,int nanos)throws InterruptedException
d. protected Object clone() throws CloneNotSupportedException
Answer  Explanation 

ANSWER: public final void wait(long timeout)throws InterruptedException

Explanation:
No explanation is available for this question!


7)   What are the main subclasses of the Exception class?

a. IOException class
b. RuntimeException Class
c. ClassCastException
d. Both A & B
Answer  Explanation 

ANSWER: Both A & B

Explanation:
No explanation is available for this question!


8)   If there is no constructor in a class, compiler automatically creates a default constructor.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


9)   Which method is used to invoke the garbage collector to perform the cleanup processing?

a. gc() method
b. finalize() method
c. q.get() method
d. None of the above
Answer  Explanation 

ANSWER: gc() method

Explanation:
No explanation is available for this question!


10)   In the following JDBC drivers which is known as fully java driver?

a. Native-API driver
b. Network Protocol driver
c. Thin driver
d. Both B & C
Answer  Explanation 

ANSWER: Both B & C

Explanation:
No explanation is available for this question!


11)   Which method in session tracking is used in a bit of information that is sent by a web server to a browser and which can later be read back from that browser?

a. HttpSession
b. URL rewriting
c. Cookies
d. Hidden form fields
Answer  Explanation 

ANSWER: Cookies

Explanation:
No explanation is available for this question!


12)   In case of Table per Concrete class, there will be three tables in the database having no relations to each other. Which are the ways to map the table?

a. By union-subclass element
b. By self-creating the table for each class
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Both A & B

Explanation:
No explanation is available for this question!


13)   A valueStack is a simply  stack that contains application specific object is _____ .

a. Action objects
b. Model object
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 middleware services are provided by EJB?

a. Security
b. Transaction Management
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Both A & B

Explanation:
No explanation is available for this question!


15)   Which is a one-way communication only between the client and the server, which is not only a reliable but also there is no confirmation regarding reaching the message to the destination?

a. TCP/IP
b. UDP
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: UDP

Explanation:
No explanation is available for this question!


16)   Which JSP Action tags is used to include the content of another resource, it may be jsp, html or servlet?

a. jsp:include
b. jsp:forward
c. jsp:plugin
d. jsp:papam
Answer  Explanation 

ANSWER: jsp:include

Explanation:
No explanation is available for this question!


17)   Which model does a Java applet or application talks directly to the data source?

a. Two-tier models
b. Three-tier models
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Two-tier models

Explanation:
No explanation is available for this question!


18)   Which method is used to suspend threads that don’t need to run when the applet is not visible?

a. destroy()
b. paint()
c. stop()
d. start()
Answer  Explanation 

ANSWER: stop()

Explanation:
No explanation is available for this question!


19)   Which package provides many event classes and Listener interfaces for event handling?

a. java.awt
b. java.awt.Graphics
c. java.awt.event
d. None of the above
Answer  Explanation 

ANSWER: java.awt.event

Explanation:
No explanation is available for this question!


20)   Wrapper classes are not used to convert any data type into an object.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


21)   Which method of URL class represents a URL and it has complete set of methods to manipulate URL in Java?

a. java.net.URL
b. java.net.URLConnection
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: java.net.URL

Explanation:
No explanation is available for this question!


22)   Which classes are used for connection-less socket programming?

a. DatagramSocket
b. DatagramPacket
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Both A & B

Explanation:
No explanation is available for this question!


23)   Which is not a W3C-recommended specification?

a. SAX
b. DOM
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: SAX

Explanation:
No explanation is available for this question!


24)   Which character in the XML Element will generate an error because the parser interprets it as the start of a new element?

a. " < "
b. "&"
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: " < "

Explanation:
No explanation is available for this question!


25)   Is this a 'well formed' XML document?
< ?xml version="1.0"? >
< note >
< to age="29" >John< /to >
< from >Smiley< / from >
< / note >


a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!