Black Friday Sale Special - Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: sntaclus

John works as a Software Developer for VenTech Inc. He writes the following code using Java.

public class vClass extends Thread

{

public static void main(String args[])

{

vClass vc=new vClass();

vc.run();

}

public void start()

{

for(int k=0;k<20;k++)

{

System.out.println("The value of k = "+k);

}

}

}

What will happen when he attempts to compile and execute the application?

A.

The application will compile successfully and the values from 0 to 19 will be displayed as the output.

B.

A compile-time error will occur indicating that no run() method is defined for the Thread class.

C.

A runtime error will occur indicating that no run() method is defined for the Thread class.

D.

The application will compile successfully but will not display anything as the output.

Which of the following code is used to create an object of security manager?

A.

SecurityManager appsm = getClassContext();

B.

SecurityManager appsm = System.getSecurityDescriptor();

C.

SecurityManager appsm = System.getSecurityManager();

D.

SecurityManager appsm = getSecurityContext();

You work as a Programmer for InfoTech Inc. You develop two html pages named authenticate.jsp and error.jsp, which are deployed directly at the root of the Web application named Authentication. Which of the following deployment descriptor code declarations will be used to ensure that the error.jsp page will be displayed automatically if the client is not authenticated?

A.

FORM

/authenticate.jsp

/error.jsp

B.

FORM

/authenticate.jsp

/error.jsp

C.

FORM

/authenticate.jsp

/error.jsp

D.

FORM

/authenticate.jsp

/error.jsp

Mark writes a class Practice.java. This class needs to access the com.bar.Test class that is stored in the Test.jar file in the directory /practice. How would you compile your code?

A.

javac -classpath /practice/Test.jar Practice.java

B.

javac -classpath /practice/ Practice.java

C.

javac -classpath /practice/Test.jar/com/bar Practice.java

D.

javac -classpath /practice Practice.java

You work as a Software Developer for UcTech Inc. You create a session using the HttpSession interface. You want the attributes to be informed when the session is moved from one JVM to another and also when an attribute is added or removed from the session. Which of the following interfaces can you use to accomplish the task?

Each correct answer represents a complete solution. Choose all that apply.

A.

HttpSessionBindingListener

B.

HttpSessionListener

C.

HttpSessionActivationListener

D.

HttpSessionAttributeListener

Martin works as a Programmer in Data Net Inc. He writes the following code.

1. class Ques0191{

2. public static void main(String[] argv){

3. byte a = 1;

4. switch(a+1){

5. case 1.

6. System.out.println("One");

7. case 2.

8. System.out.println("2");

9. case 2.

10. System.out.println("Two"); break;

11. }

12. }

13. }

What will happen when Martin attempts to compile and execute the code?

A.

The code will compile successfully, but a runtime error will occur because of the duplicate case label at line number 9.

B.

The code will not compile because of the duplicate case label at line number 9.

C.

The code will compile successfully and will execute displaying 2 followed by Two.

D.

The code will not compile because an argument to the switch must be a constant.

You work as a Software Developer for NewTech Inc. You want to configure the deployment descriptor so as to specify the error pages used in the FORM based authentication. Which of the following elements will you use to accomplish the task?

A.

The sub-element of the element.

B.

The sub-element of the element.

C.

The sub-element of the element.

D.

The sub-element of the element.

Which of the following functions are performed by methods of the

HttpSessionActivationListener interface?

Each correct answer represents a complete solution. Choose all that apply.

A.

Notifying the object when it is bound to a session.

B.

Notifying an attribute that a session has just migrated from one JVM to another.

C.

Notifying the object when it is unbound from a session.

D.

Notifying an attribute that a session is about to migrate from one JVM to another.

The following JSP scriptlet is given.

<% response.setContentType("text/html; charset=ISO-8859-1"); %>

Which of the following directives is the equivalent directive for the scriptlet given above?

A.

<%@ include contentType="text/html; pageEncoding=ISO-8859-1" %>

B.

<%@ include contentType="text/html; charset=ISO-8859-1" %>

C.

<%@ page contentType="text/html; charset=ISO-8859-1" %>

D.

<%@ taglib contentType="text/html; pageEncoding=ISO-8859-1" %>

Mark works as a Programmer for InfoTech Inc. He creates a program that uses the following code.

1. class Book

2. {

3. Short f1= 15;

4. Book GetDetails(Book b1)

5. {

6. b1=null;

7. return b1;

8. }

9. public static void main(String args[])

10. {

11. Book b1 = new Book();

12. Book b2 = new Book();

13. Book b3 = b1.GetDetails(b2);

14. b1=null;

15. //code

16. }

17. }

How many objects will be eligible for garbage collection when line 15 is reached?

A.

It cannot be determined.

B.

1

C.

2

D.

0