Java Test Questions Set 12

1)   Multiple inheritances is not supported in case of class but it is supported in case of interface.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


2)   What output you will get if you run this program?
class Modulus {
public static void main(String args[]) {
int x = 42;
double y = 42.25;
System.out.println("x mod 10 = " + x % 10);
System.out.println("y mod 10 = " + y % 10);
}
}


a. x mod 10 = 2
y mod 10 = 2.25

b. x mod 10 = 4
y mod 10 = 2.50

c. x mod 10 = 6
y mod 10 = 3.25

d. x mod 10 = 2
y mod 10 = 4.25

Answer  Explanation 

ANSWER: x mod 10 = 2
y mod 10 = 2.25

Explanation:
No explanation is available for this question!


3)   Which class automatically flushes the data so that there is no need to call the flush() method. Moreover, its methods don't throw IOException?


a. Console class
b. Scanner Class
c. FileInputStream class
d. PrintStream class
Answer  Explanation 

ANSWER: PrintStream class

Explanation:
No explanation is available for this question!


4)   How many methods does a thread class provides for sleeping a thread?

a. 3
b. 1
c. 4
d. 2
Answer  Explanation 

ANSWER: 2

Explanation:
No explanation is available for this question!


5)   Which class members can be accessed from the classes in the same package as well as classes in other Packages that are subclasses of the declaring class?

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

ANSWER: Protected

Explanation:
No explanation is available for this question!


6)   Which method of object class can clone an object?

a. copy()
b. Objectcopy()
c. Objectclone()
d. Clone()
Answer  Explanation 

ANSWER: Objectclone()

Explanation:
No explanation is available for this question!


7)   Which is a technique in Java in which a class can have any number of constructors that differ in parameter lists?

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

ANSWER: Constructor overloading

Explanation:
No explanation is available for this question!


8)   ResultSet object can be moved forward only and it is updatable.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


9)   Which packages represent interfaces and classes for servlet API?

a. javax.servlet
b. javax.servlet.http
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Both A & B

Explanation:
No explanation is available for this question!


10)   Hibernate caching improves the performance of the application by pooling the object in the cache.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


11)   Which pattern is the struts framework based?

a. MVC2 Pattern
b. Bridge Pattern
c. MVC 1 Pattern
d. None of the above
Answer  Explanation 

ANSWER: MVC2 Pattern

Explanation:
No explanation is available for this question!


12)   JMS is also known as a messaging service.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


13)   Which program obtains a remote reference to one or more remote objects on a server and then invokes methods on them in an RMI application?

a. Server
b. Client
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Client

Explanation:
No explanation is available for this question!


14)   Which action tags are used in JSP for developing web application with Java Bean?

a. jsp:useBean
b. jsp:setProperty
c. jsp:getProperty
d. Both B & C
Answer  Explanation 

ANSWER: Both B & C

Explanation:
No explanation is available for this question!


15)   JDBC technology-based drivers generally fit into how many categories?

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

ANSWER: 4

Explanation:
No explanation is available for this question!


16)   Which JDBC type represents a 64-bit signed integer value between -9223372036854775808 and 9223372036854775807?

a. SMALLINT
b. BIGINT
c. TINYINT
d. INTEGER
Answer  Explanation 

ANSWER: BIGINT

Explanation:
No explanation is available for this question!


17)   When an applet is terminated which of the following sequence of methods calls take place?

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

ANSWER: stop(),destroy()

Explanation:
No explanation is available for this question!


18)   Which method is called only once during the run time of your applet?

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

ANSWER: init()

Explanation:
No explanation is available for this question!


19)   Which is a component in AWT that can contain another components like buttons, textfields, labels etc.?

a. Window
b. Container
c. Panel
d. Frame
Answer  Explanation 

ANSWER: Container

Explanation:
No explanation is available for this question!


20)   Which allows the caller to remove elements from the underlying collection during the iteration with well-defined semantics?

a. Enumeration
b. Iterator
c. None of the above

Answer  Explanation 

ANSWER: Iterator

Explanation:
No explanation is available for this question!


21)   Consider the following two statements

int x = 25;
Integer y = new Integer(33);
What is the difference between these two statements?


a. Primitive data types
b. primitive data type and an object of a wrapper class
c. Wrapper class
d. None of the above
Answer  Explanation 

ANSWER: primitive data type and an object of a wrapper class

Explanation:
No explanation is available for this question!


22)   Which is a language for finding information in an XML document?

a. Xpath
b. XSLT
c. XLink
d. XPointer
Answer  Explanation 

ANSWER: Xpath

Explanation:
No explanation is available for this question!


23)   Which are the main features of XML?

a. Text data description
b. Human- and computer-friendly format
c. Handles data in a tree structure having one-and only one-root element
d. All mentioned above
Answer  Explanation 

ANSWER: All mentioned above

Explanation:
No explanation is available for this question!


24)   Which language is Extensible Markup Language (XML) similar?

a. HTML
b. PHP
c. avaScript
d. Wordpress
Answer  Explanation 

ANSWER: HTML

Explanation:
No explanation is available for this question!


25)   Which class is thread-safe i.e. multiple threads cannot access it simultaneously,So it is safe and will result in an order?

a. StringBuffer class
b. StringBuilder class
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: StringBuffer class

Explanation:
No explanation is available for this question!