Java Test Questions Set 8

1)   If a subclass has the same method as declared in the parent class it is known as ______.

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

ANSWER: Method overriding

Explanation:
No explanation is available for this question!


2)   Which type of inheritance one super-class have more than one sub-class?

a. Hierarchical inheritance
b. Single inheritance
c. Multiple inheritances
d. Multilevel inheritance
Answer  Explanation 

ANSWER: Hierarchical inheritance

Explanation:
No explanation is available for this question!


3)   Which stream does Java application uses to read data from a source, it may be a file, an array, peripheral device or socket?

a. InputStream
b. OutputStream
c. Input/OutputStream
d. None of the above
Answer  Explanation 

ANSWER: InputStream

Explanation:
No explanation is available for this question!


4)   Which method is used in thread class to starts the execution of the thread?

a. public void start()
b. public void run()
c. public void stop()
d. public void suspend()
Answer  Explanation 

ANSWER: public void start()

Explanation:
No explanation is available for this question!


5)   Which packages are also termed as Java API Packages?

a. Java System Packages
b. User Defined Package
c. Java Defined Packages
d. None of the above
Answer  Explanation 

ANSWER: Java System Packages

Explanation:
No explanation is available for this question!


6)   Which symbol is used to contain the values of automatically initialized arrays. Also used to define a block of code, for classes, methods, and local scopes?

a. Brackets
b. Braces
c. Parentheses
d. Semicolon
Answer  Explanation 

ANSWER: Braces

Explanation:
No explanation is available for this question!


7)   PatternSyntaxException Class Methods is an unchecked exception that indicates a syntax error in a regular expression pattern.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


8)   What is the advantage of Method Overloading?

a. Method overloading increases the readability of the program
b. Method overloading does not increases the readability of the program
c. Method overloading does not increases the reliability of the program
d. None of the above
Answer  Explanation 

ANSWER: Method overloading increases the readability of the program

Explanation:
No explanation is available for this question!


9)   Garbage Collection is the process of reclaiming the runtime unused memory automatically.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


10)   How many steps are used to connect any java application using JDBC?

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

ANSWER: 5

Explanation:
No explanation is available for this question!


11)   What is the lifecycle of a servlet?

a. Servlet class is loaded
b. Servlet instance is created
c. init,Service,destroy method is invoked
d. All mentioned above
Answer  Explanation 

ANSWER: All mentioned above

Explanation:
No explanation is available for this question!


12)   In the elements of Hibernate architecture is a factory of session and client of ConnectionProvider, It holds the second level cache (optional) of data is _____.

a. Session
b. SessionFactory
c. Transaction
d. ConnectionProvider
Answer  Explanation 

ANSWER: SessionFactory

Explanation:
No explanation is available for this question!


13)   The values configured in struts.properties file will override the default values configured in default.properties which is contained in the struts2-core-x.y.z.jar distribution.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


14)   In EJB, middleware services are provided by EJB Container automatically.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


15)   1099 is the default port used by RMI Registry.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


16)   Which tag is used to execute java source code in JSP?

a. Declaration Tag
b. Scriptlet tag
c. Expression tag
d. None of the above
Answer  Explanation 

ANSWER: Scriptlet tag

Explanation:
No explanation is available for this question!


17)   Which was the first most widely used programming interface for accessing relational databases and it offers the ability to connect all the databases on all the platforms.?

a. JDBC API
b. ODBC API
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: ODBC API

Explanation:
No explanation is available for this question!


18)   Java Plug-in software is not responsible to manage the lifecycle of an Applet.

a. True
b. False


Answer  Explanation 

ANSWER: False

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)   What package is a part of the wrapper class which 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)   Which methods are commonly used in ServerSocket class?

a. public OutputStream getOutputStream()
b. public Socket accept()
c. public synchronized void close()
d. None of the above
Answer  Explanation 

ANSWER: public Socket accept()

Explanation:
No explanation is available for this question!


22)   Which constructor of DatagramSocket class is used to creates a datagram socket and binds it with the given Port Number?

a. DatagramSocket(int port)
b. DatagramSocket(int port, InetAddress address)
c. DatagramSocket()
d. None of the above
Answer  Explanation 

ANSWER: DatagramSocket(int port, InetAddress address)

Explanation:
No explanation is available for this question!


23)   Which is not a XML function?

a. Transport information
b. Style information
c. Store information
d. Structure information
Answer  Explanation 

ANSWER: Style information

Explanation:
No explanation is available for this question!


24)   XML is a programming language like C# or Java.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


25)   Which are the techniques for defining the structure of a specific type of XML documents?

a. Schema
b. DTD
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Both A & B

Explanation:
No explanation is available for this question!