1 <libraryPrefix:handlerName parameterNAme="value"> 2 <%=23*counter %> 3 <b>Congratulations!</b> Which of the following is the correct way to complete the code snippet above?
</libraryPrefix:handlerName> 88.0%
</libraryPrefix:handlerName paremeterName="value"> 8.0%
</handlerName> 1.0%
<libraryPrefix> 1.0%
As part of the type erasure process, when compiling a class or interface that extends a parameterized class or implements a parameterized interface, the compiler may need to create a synthetic meth...
bridge method 83.0%
helper method 0.0%
stub method 16.0%
raw method 0.0%
Assuming that val has been defined as an int for the code below, which values of val will result in "Test C" being printed? if( val > 4 ) { System.out.println("Test A"); } else if( val > 9 ) { ...
val < 0 31.0%
val between 0 and 4 37.0%
val between 4 and 9 0.0%
val > 9 0.0%
val = 0 29.0%
No values for val will result in "Test C" being printed. 2.0%
Assuming the servlet method for handling HTTPGET requests is doGet(HttpServletRequest req, HTTPServletResponse res), how can the request parameter in that servlet be retrieved?
String value=req.getInitParameter(10); 0.0%
String value=req.getInitParameter("product"); 0.0%
String value=res.getParameter("product"); 2.0%
String value=req.getParameter("product"); 97.0%
Choose all valid forms of the argument list for the FileOutputStream constructor shown below:
FileOutputStream( FileDescriptor fd ) 32.0%
FileOutputStream( String n, boolean a ) 30.0%
FileOutputStream( boolean a ) 0.0%
FileOutputStream() 0.0%
FileOutputStream( File f ) 36.0%
Consider the following code: public class Jam { public void apple(int i, String s) { } //ABC } Choose possible valid code replacements of "//ABC" among the choices:
public void apple(String s, int i) {} 53.0%
public int apple(int i, String s) {} 1.0%
public void apple(int i, String mystring) {} 0.0%
public void Apple(int i, String s) {} 44.0%
Consider the following code: public static void main(String bicycle[]) { System.out.println(bicycle[0]); } What would be the result if "java TwoTyre one two" is entered in the command line?
one 88.0%
two 0.0%
TwoTyre 0.0%
None of the above 11.0%
Conventionally, which directory do servlet class files get placed on?
WEB-INFservlets 2.0%
webappservlets 0.0%
WEB-INFclasses 97.0%
WEB-INF 0.0%
How does the set collection deal with duplicate elements?
Duplicate values will cause an error at compile time. 0.0%
A set may contain elements that return duplicate values from a call to the equals method. 0.0%
An exception is thrown if you attempt to add an element with a duplicate value. 0.0%
The add method returns false if you attempt to add an element with a duplicate value. 100.0%
How many objects are created by the following code? Object a, b, c, d, e; e = new Object (); b = a = e; e = new Object ();
2 100.0%
5 0.0%
4 0.0%
That code is invalid. 0.0%
How many objects are created in the given code? Object x, y, z; x = new Object(); y = new Object()
0 0.0%
1 2.0%
2 97.0%
3 0.0%
How many objects are created in the given code? Object x, y, z; x = new Object(); y = new Object();
0 0.0%
1 0.0%
2 100.0%
3 0.0%
In which class is the notify method defined?
Thread 0.0%
Applet 0.0%
Runnable 0.0%
Object 100.0%
JDBC is based on:
X/Open CLI (Call Level Interface) 97.0%
JDBC/Open CLI 2.0%
Java/Open CLI 0.0%
V/OPEN CLI 0.0%
V/CLOSE CLI 0.0%
RMI allows remote communication between:
C++ and Java 0.0%
C and Java 0.0%
Pascal and Java 0.0%
Java and Java 94.0%
Java and TCP/IP 5.0%
Select all correct statements:
Vector is synchronized, ArrayList is not synchronized 51.0%
Hashtable is synchronized, HashMap is not synchronized 48.0%
Vector is not synchronized, ArrayList is synchronized 0.0%
Hashtable is not synchronized, HashMap is synchronized 0.0%
Select all true statements:
An abstract class can have non-abstract methods. 40.0%
A non-abstract class can have abstract methods. 0.0%
If a non-abstract class implements interface, it must implement all the methods of the interface. 36.0%
If a non-abstract class inherits abstract methods from its abstract superclass, it must implement the inherited abstract methods. 23.0%
SQLException has a feature of chaining - identify the right code to execute the same from the following options:
catch(SQLException e) { out.println(e.getMessage()); while((e=e.getNextException())!=null) { out.println(e.getMessage()); } } 83.0%
catch(SQLException e) { out.println(e.getNextException()); while((e=e.getMessage())!=null) { out.println(e.getMessage()); } } 16.0%
catch(SQLException e) { out.println(e.getMessage()); while((e=e.getEncapsulatedException())!=null) { out.println(e.getMessage()); } } 0.0%
catch(ClassNotFoundException e) { out.println(e.getMessage()); while((e=e.getNextException())!=null) { out.println(e.getMessage()); } } 0.0%
catch(ClassNotFoundException e){ { out.println(e.getMessage()); } } 0.0%
The following code was written to save a handle to an EJBObject named 'bookEJBObject' for an online book shop: javax.ejb.Handle bookHandle = _____________; ObjectOutputStream stream = new ObjectO...
(Handle) bookEJBObject() 0.0%
bookEJBObject.getHandle() 100.0%
bookEJBObject.getEJBHandle() 0.0%
newHandleInstance() 0.0%
The JDK comes with a special program that generates skeleton and stub objects that is known as:
java.rmi.Remote 0.0%
rmi 3.0%
rmic 96.0%
rmijava 0.0%
javac 0.0%
The principal finder method that must be implemented by every entity bean class is:
findByPrimaryKey() 92.0%
ejbGetByPrimaryKey() 3.0%
ejbFindPrimayKey() 3.0%
getPrimaryKey() 0.0%
getFinder() 0.0%
The transaction attribute of a bean is set to 'TX_REQUIRES_NEW.' What can be inferred about its behavior?
It initiates a new transaction only when the previous one is concluded. 0.0%
It initiates a new transaction without waiting for the previous one to conclude. 0.0%
It sends the request to the EJB container for initiating a new bean. 4.0%
The bean manages its own transaction. 95.0%
There are three classes named A, B, and C. The class B is derived from class A and class C is derived from B. Which of the following relations are correct for the given classes?
Any instance of A is an instance of B. 4.0%
Any instance of B is an instance of A. 48.0%
Any instance of C is an instance of B. 44.0%
Any instance of B is an instance of C. 4.0%
What exception is thrown by this code, if arr[j]>arr[j+1]: public static void main(String[] args) { int []arr={12,23,43,34,3,6,7,1,9,6}; { int temp; for ...
NumberFormatException 0.0%
ArrayIndexOutOfBoundException 100.0%
IOException 0.0%
What is the output of the given code? public class Test15 { public static void main(String[] args) { VO a = new VO(2); VO b = new VO(3); swa...
2332 89.0%
3232 0.0%
3223 10.0%
2323 0.0%
What is the output of the given console application? public class Test19 { public static void main(String[] args) { final int X = 9; int[][] a = {{5, 4, 3},...
'5 0.0%
5 4 3 7.0%
5 4 3 1 6 8 92.0%
5 4 3 7 2 1 6 8 0.0%
What is the output of the given console application? public class Test31 { public static void main(String[] args) { test(); } public static void test() { ...
-try 0.0%
-try-catch 4.0%
-try-finally 95.0%
-try-catch-finally 0.0%
What is the output of the given program? public class Test106 { public static void main(String[] args) { Integer x = 0; Integer y = 0; Integ...
The code will not compile, because Integer is a class, and an object must be created by calling its constructor: Integer a = new Integer(1); or, alternatively, a primitive type must be used: int a = 1; 0.0%
true; true 0.0%
false; false 0.0%
false; true 100.0%
What is the output of the given program? public class Test118 extends _Test118 { { System.out.print("_INIT"); } static { System.out.print("_...
_STATIC_MAIN_BASE_INIT_CONST 100.0%
_STATIC_MAIN_INIT_BASE_CONST 0.0%
_INIT_STATIC_MAIN_BASE_CONST 0.0%
What is the output of the given program? public class Test120 extends _Test120 { { System.out.print("_INIT"); } static { System.out.print("_...
_START_STATIC_MAIN_BIN_BASE_INIT_CONST 100.0%
_STATIC_START_MAIN_BIN_BASE_INIT_CONST 0.0%
_STATIC_MAIN_START_BIN_BASE_INIT_CONST 0.0%
_START_MAIN_STATIC_BIN_BASE_INIT_CONST 0.0%
What is the output of the given program? public class Test129 { public static void main(String[] args) { A a = new A2(); B b = new B2(); Sys...
1 0.0%
2 0.0%
11 94.0%
22 5.0%
What is the output of the given program? public class Test130 { public static void main(String[] args) { A a = new A2(); B b = new B2(); Sys...
11 0.0%
12 100.0%
21 0.0%
22 0.0%
What is the output of the given program? public class Test89 { public static void main(String[] args) { T x = new T(""X"", null); x.start(); T y = new T(""Y...
Always XYZ 0.0%
Always ZYX 0.0%
Any of the following: XYZ, XZY, YXZ, YZX, ZXY, ZYX 100.0%
Any of the following: XYZ, ZYX 0.0%
What is the output of the given program? public class Test89 { public static void main(String[] args) { T x = new T("X", null); x.start(); T y = new T("Y", ...
always XYZ 0.0%
always ZYX 0.0%
any of the following: XYZ, XZY, YXZ, YZX, ZXY, ZYX 100.0%
any of the following: XYZ, ZYX 0.0%
What is the output of the given program? public class Test93 { private int x = 0; public static void main(String[] args) { new Test93().test(); } ...
## 0.0%
#g 0.0%
f# 100.0%
fg 0.0%
What is the output of the given program? public class Test97 { public static void main(String[] args) { int[][] a = new int[2][2]; System.out.println(a.leng...
0 0.0%
2 100.0%
3 0.0%
4 0.0%
What is the result of an attempt to compile and run the given program? public class Test107 { public static void main(String[] args) { System.out.println(test()); }...
It gets a compiler error, because of an attempt to return null from the method with return type "int". 0.0%
It compiles, but throws NullPointerException at run-time. 100.0%
It compiles, runs, and prints "null" (without quotes). 0.0%
It compiles, runs, and prints "0" (without quotes). 0.0%
What is the term to describe a situation where two or more threads are blocked forever, waiting for each other?
deadlock 100.0%
starvation 0.0%
livelock 0.0%
liveness 0.0%
What protocol is used by the DatagramSocket class?
STCP 3.0%
UDP 96.0%
TCP 0.0%
FTP 0.0%
None of the above 0.0%
What should be the replacement of "//ABC" in the following code? class Krit { String str= new String("OOPS !!! JAVA"); public void KritMethod(final int iArgs) { int iOne; c...
System.out.print(str); 50.0%
System.out.print(iOne); 0.0%
System.out.print(iTwo); 0.0%
System.out.print(iArgs); 50.0%
What will be the output of the following code? public class MyTest { public static void main(String[] args) { for (int i=0; i > 10; i+=2) { System.out.println(i); }...
Nothing will be printed. 100.0%
It will print the following output: 0 2 4 6 8 0.0%
Compile time error 0.0%
It will print the following output: 0 1 2 3 4 5 6 7 8 9 0.0%
What will be the output of this program? public class Test { public static void main(String args[]) { int a, b; a = 2; b = 0; System.out.println(g(a, new int[] { b })); } public stat...
0 0.0%
1 0.0%
An exception will occur 0.0%
4 100.0%
What will be the output when this code is compiled and run? public class Test { public Test() { Bar b = new Bar(); Bar b1 = new Bar(); update(b); update(b1); b1 = b; update(b); up...
The code will fail to compile. 0.0%
10 10 10 10 0.0%
20 20 20 20 100.0%
10 20 10 20 0.0%
What will be the output when this code is compiled and run? public class Test { public Test() { Bar b = new Bar(); Bar b1 = new Bar(); update(b); update(b1); ...
The code will fail to compile. 0.0%
10 10 10 10 0.0%
20 20 20 20 100.0%
10 20 10 20 0.0%
What will be the output, if the following program is run? public class Test8 { public static void main(String[] args) { System.out.println(Math.sqrt(-4)); } }
null 0.0%
2 0.0%
NaN 100.0%
-2.0 0.0%
What would be the result of compiling and running the following code class? public class Test { public static void main(String args[]) { Test t = new Test(); t.start(); } public void sta...
The code will not compile. 0.0%
The code will compile but will give a runtime error. 0.0%
The code will compile and print 2. 100.0%
The code will compile and print 1. 0.0%
What would happen on trying to compile and run the following code? class House { public final void MaintainMethod() { System.out.println("MaintainMethod"); } } public class Building extends...
A runtime error will occur because class House is not defined as final. 0.0%
Successful compilation and output of "MaintainMethod" at run time. 100.0%
A compilation error indicating that a class with any final methods must be declared final itself. 0.0%
A compilation error indicating that you cannot inherit from a class with final methods. 0.0%
Which class contains a method to create a directory?
File 100.0%
DataOutput 0.0%
Directory 0.0%
FileDescriptor 0.0%
FileOutputStream 0.0%
Which design pattern reduces network traffic by acting as a caching proxy of a remote object?
DataAccess Object 0.0%
Model-View-Controller 0.0%
Value Object 94.0%
Business Delegate 5.0%
Which distributed object technology is most appropriate for systems that consist entirely of Java objects?
RMI 94.0%
CORBA 0.0%
DCOM 0.0%
COM 5.0%
JDBC 0.0%
Which distributed object technology is most appropriate for systems that consist of objects written in different languages and that execute on different operating system platforms?
RMI 0.0%
CORBA 94.0%
COBRA 0.0%
DCOM 0.0%
COM 5.0%
Which exception must a setter of a constrained JavaBean property throw to prevent the property value from changing?
PropertyVetoException 92.0%
IllegalArgumentException 0.0%
IllegalComponentStateException 7.0%
InvalidAttributeValueException 0.0%
Which is a proper way to declare and throw exception of class XYException?
class XYException extends Exception {} ... throw new XYException(); 100.0%
class XYException implements Exception {} ... throw new XYException(); 0.0%
class XYException extends Exception {} ... throw new Exception(""XYException""); 0.0%
class XYException implements Exception {} ... throw new Exception(""XYException){}; 0.0%
Which method in the HttpServlet class corresponds to the HTTPPUT method?
put 5.0%
doPut 94.0%
httpPut 0.0%
putHttp 0.0%
Which method is called by the servlet container just after the servlet is removed from service?
public void finalize() {// code...} 0.0%
public void destroy() {// code...} 94.0%
public void destroy()throws ServletException {// code...} 5.0%
public void finalize()throws ServletException {// code...} 0.0%
Which of the following are the methods of the Thread class?
stay() 0.0%
go() 0.0%
yield() 51.0%
sleep(long millis) 48.0%
Which of the following are valid ways to define a thread in Java?
Create a subclass of java.lang.Thread class 50.0%
Create a class that implements java.lang.Runnable 47.0%
Define method run() in a class 0.0%
Define method call() in a class 2.0%
Which of the following cannot apply to constructors?
Name same as class name 0.0%
Void return type 100.0%
Can have parameters 0.0%
Overloading 0.0%
Which of the following code snippets will generate five random numbers between 0 and 200?
Random r = new Random(); for (int i = 0; i < 5; i++) { System.out.println(r.nextInt(0,200)); } 5.0%
Random r = new Random(200); for (int i = 0; i < 5; i++) { System.out.println(r.nextInt()); } 0.0%
Random r = new Random(); for (int i = 0; i < 5; i++) { System.out.println(r.nextInt(200)); } 94.0%
Random r = new Random(200); for (int i = 0; i < 5; i++) { System.out.println(r.nextInt(0)); } 0.0%
Which of the following code snippets will take transform input string "2012/06/05" to output string "05 - 06 - 2012"?
String dateString = "2012/06/05"; Date date = new SimpleDateFormat("yyyy/MM/dd").parse(dateString); SimpleDateFormat sdf = new SimpleDateFormat("dd - MM - yyyy"); System.out.println(sdf.format(date)); 95.0%
String dateString = "2012/06/05"; Date date = new SimpleDateFormat("yyyy/MM/dd").format(dateString); SimpleDateFormat sdf = new SimpleDateFormat("dd - MM - yyyy"); System.out.println(sdf.parse(date)); 4.0%
String dateString = "2012/06/05"; Date date = new SimpleDateFormat("dd - MM - yyyy").format(dateString); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); System.out.println(sdf.parse(date)); 0.0%
String dateString = "2012/06/05"; Date date = new SimpleDateFormat("dd - MM - yyyy").parse(dateString); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); System.out.println(sdf.format(date)); 0.0%
Which of the following illustrates correct synchronization syntax?
public synchronized void Process(void){} 0.0%
public void Process(){ synchronized(this){ } } 48.0%
public void synchronized Process(){} 0.0%
public synchronized void Process(){} 51.0%
Which of the following interfaces makes it possible for Java to save an object to a file and turn it into a data stream?
java.io.Serialization 0.0%
java.net.Serializable 0.0%
java.net.Serialization 0.0%
java.io.Serializable 100.0%
java.net.io.Serializable 0.0%
Which of the following is a well-known HTTP port?
21 0.0%
25 0.0%
8080 21.0%
80 78.0%
137 0.0%
Which of the following is false?
A scrollable ResultSet can be created in JDBC 2.0 API. 0.0%
The cursor is moved forward using next(). 0.0%
The cursor is moved backward using previous(). 5.0%
A while loop can be used because next() & previous() methods return false beyond the resultset. 26.0%
A while loop can be used because next () & previous () methods return -1 beyond the resultset. 68.0%
Which of the following is the correct syntax for creating a Session object?
HttpSession ses=request.getSession(true); 45.0%
HttpSession ses=getSession(true); 2.0%
HttpSession ses=request.getSession(); 48.0%
HttpSession ses=request.getSessionObject(true); 2.0%
HttpSession ses=response.getSession(true); 0.0%
Which of the following is the correct syntax for suggesting that the JVM perform garbage collection?
System.setGarbageCollection(); 0.0%
System.out.gc(); 0.0%
System.gc(); 100.0%
System.free(); 0.0%
Which of the following is the name of the cookie used by Servlet Containers to maintain session information?
SESSIONID 0.0%
SERVLETID 11.0%
JSESSIONID 88.0%
CONTAINERID 0.0%
Which of the following JDBC methods is used to retrieve large binary objects?
getBinaryStream() 93.0%
getText() 0.0%
getAsciiStream 0.0%
getString() 0.0%
getUniStream() 6.0%
Which of the following methods are members of the Vector class and allow you to input a new element?
addItem 0.0%
append 5.0%
insert 5.0%
addElement 90.0%
Which of the following methods can be used for reporting a warning on a Connection object, Statement object & ResultSet object?
getWarnings() 94.0%
getWarned() 0.0%
getWarning() 5.0%
getError() 0.0%
getErrors() 0.0%
Which of the following methods should be invoked by the container to get a bean back to its working state?
EJBPassivate() 5.0%
EJBActivate() 94.0%
EJBRemove() 0.0%
EJBOpen() 0.0%
EJBActivation() 0.0%
Which of the following require explicit try/catch exception handling by the programmer?
Accessing a method in another class 0.0%
Attempting to open a network socket 51.0%
Attempting to open a file 48.0%
Traversing each member of an array 0.0%
Which of the following statements is true of the HashMap class?
It stores information as key/value pairs. 100.0%
Elements are returned in the order they were added. 0.0%
It does not permit null keys. 0.0%
It does not permit null values. 0.0%
Which of the following statements is true?
public interface RemoteTrain extends java.rmi.Remote 94.0%
public class RemoteTrain extends java.rmi.Remote 5.0%
public interface RemoteTrain extends java.net.Remote 0.0%
public class RemoteTrain extends java.net.Remote 0.0%
private class RemoteTrain extends java.net.Remote 0.0%
Which of the following statements regarding abstract classes are true?
All methods declared in an abstract class must be abstract. 0.0%
Any subclass (abstract or concrete class) of an abstract class must implement all the methods declared in the parent abstract class. 7.0%
Any concrete class must implement all the methods of the parent abstract class which are not implemented in the super hierarchy tree. 42.0%
The abstract class may have method implementation. 50.0%
Which of the following symbols are metacharacters supported by the java.util.regex API?
. 50.0%
50.0%
@ 0.0%
# 0.0%
Which of the following transaction modes are supported by Enterprise Java Beans?
TX_NOT_SUPPORTED 0.0%
TX_BEAN_MANAGED 5.0%
TX_REQUIRED 0.0%
TX_MANDATORY 0.0%
All of the above 95.0%
Which of these interfaces are used by implementations of models for JTable?
TableModel 53.0%
TableColumnModel 46.0%
TableSelectionModel 0.0%
ListModel 0.0%
Which of these interfaces is the most applicable when creating a class that associates a set of keys with a set of values?
Collection 0.0%
Set 0.0%
Map 100.0%
SortedSet 0.0%
Which of these is not an event listener adapter defined in the java.awt.event package?
ActionAdapter 93.0%
MouseListener 0.0%
WindowAdapter 6.0%
FocusListener 0.0%
Which option could be used to see additional warnings about code that mixes legacy code with code that uses generics?
-Xlint:unchecked 94.0%
-Xlint:-unchecked 0.0%
-Xswitchcheck or -Xlint:fallthrough depending on the version of Java 5.0%
-classpath or -cp 0.0%
Which option lists Java access modifiers in the right order from the most permissive to the most restrictive?
public, protected, <i>no modifier/default/package</i>, private 100.0%
public, <i>no modifier/default/package</i>, protected, private 0.0%
<i>no modifier/default/package</i>, public, protected, private 0.0%
public, protected, private, <i>no modifier/default/package</i> 0.0%
Which sequence will be printed when the following program is run? import java.util.*; public class Test { public static void main(String str[]) { List l = new ArrayList(); l.add(''1''); ...
[1, 3, 2] 100.0%
[1, 3, 1] 0.0%
[1, 1, 3] 0.0%
[1, 1, 2] 0.0%
This code will generate an error. 0.0%
Which statement is true about the given code? public class Test78 { public static void main(String[] args) throws Exception { new JBean().setHeight(1).setWidth(2).setDepth(...
The code does not compile, because two setters have a formal parameter with the same name. 0.0%
The setters of the JBean class are JavaBean-compliant. 0.0%
The code compiles, but throws a NullPointerException at run-time. 0.0%
The code compiles and runs. 100.0%
Which statement is true regarding ServletContext Initialization Parameters in the deployment descriptor?
They are accessible by all servlets in a given web application. 94.0%
They are accessible by all servlets in a given session. 5.0%
They are accessible by all servlets in a given HTTP request. 0.0%
They are accessible by all servlets in a given container. 0.0%
Which statements are true regarding ServletContext Init Parameters in the deployment descriptor?
They are set at deployment-time, but accessed at run-time. 35.0%
They are accessible from any session within that context. 27.0%
They are not set at deployment-time, but accessed at run-time. 2.0%
They are set at deployment-time and can be updated at run-time. 35.0%
Which statements are true? Select all true statements.
A member variable can be declared synchronized. 0.0%
A class can be declared transient. 0.0%
A class be declared synchronized. 0.0%
A method can be declared synchronized. 100.0%
Why can't a Graphics object be created using the following statement? Graphics g = new Graphics();
The Graphics class is a final class. 0.0%
The Graphics class is an abstract class. 95.0%
The constructor of the Graphic class needs a color object to be passed as a parameter, e.g Graphics g = new Graphics(new Color());. 4.0%
With regard to the destroy lifecycle method, identify the correct statements about its purpose or about how and when it is invoked.
It gives the servlet an opportunity to clean up resources. 63.0%
Like try-catch, it is called upon an exception. 0.0%
It is rarely used but can be called to remove a servlet from memory. 27.0%
It isn't called if the server crashes. 9.0%
X.509 version 3 specifies which of the following?
A format and content for digital certificates. 88.0%
The IPSec standard. 5.0%
The Secure Socket Layer. 0.0%
The Data Encryption Standard. 5.0%
A file for digital certificates. 0.0%