3 Months Free Update
3 Months Free Update
3 Months Free Update
Given the following directory structure.
Assuming that the current directory is com, which of the below options can be used to create a jar file called TestJar.jar that contains all the files from the directory testApp?
You work as a Software Developer for UcTech Inc. You are building a Web site that will contain study materials on the Java language. The company wants that members can access all the pages, but nonmembers have only limited access to the Web site pages. Which of the following security mechanisms will you use to accomplish the task?
Which of the following code snippets will read the eighth byte of the file wRead.txt into the variable str?
Which of the following methods are used in the verification of a signature?
Each correct answer represents a complete solution. Choose all that apply.
Mark develops an application using Java language. He writes the following code snippet in the application.
public class mClass{
public static void main(String args[]){
try{
return;
}
finally{System.out.print("Finally");}}}
What will happen when Mark attempts to compile and execute the code snippet?
Which of the following circumstances can prevent the execution of code in a finally block?
Each correct answer represents a complete solution. Choose two.
There are two threads defined in an application named "thread1" and "thread2". Which of the following options can be the direct cause of "thread1" becoming blocked?
Each correct answer represents a complete solution. Choose all that apply.
Roger works as a Software Developer for Tech Mart Inc. He creates an application using Enterprise JavaBeans. In the bean class, he writes a code snippet as follows.
Boolean b = ctx.isCallerInRole("Administrator");
The Application Assembler named Bob declares the following entries within the
1.
2. The HR-Manager will have permission to access all the methods.
3.
4.
5.
Bob wants to ensure that the HR-Manager declared in the deployment descriptor has all the privileges of an administrator. Which of the following elements should Bob declare in line 4 while deploying the bean?
Mark works as a Programmer for InfoTech Inc. He develops the following code snippet.
package Mark.tutorial.javaee.ejb;
import java.util.logging.Logger;
import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.ejb.Timeout;
import javax.ejb.Timer;
import javax.ejb.TimerService;
@Stateless
public class TimerBean implements TimerSessionBean {
@Resource
TimerService timerService;
private static final Logger logger = Logger.getLogger
("com.sun.tutorial.javaee.ejb.timersession.TimerSessionBean");
public void createTimer(long intervalDuration) {
Timer timer = timerService.createTimer(intervalDuration, "New timer created");
}
@Timeout
public void timeout(Timer timer) {
logger.info("Timer Timeout");
}
}
which of the following statements are true about the code?
Each correct answer represents a complete solution. Choose all that apply.
Which of the following statements about a JAR file are true?
Each correct answer represents a complete solution. Choose all that apply.
Which of the following is the return type of the getInitParameter() method of the ServletContext interface?
Which of the following exceptions will be thrown by the validate method if the result type does not match the Source type, or if the specified source is neither SAXSource nor DOM Source?
You work as a programmer for PassGuide.Inc. You have a session object named session1 with an attribute named Attribute1, and an HttpSessionBindingEvent object binding1 bound to session1.
Which of the following will be used to retrieve Attribute1?
Each correct answer represents a complete solution. Choose all that apply.
Which of the following exceptions is thrown if a class uses the clone() method but does not implement the Cloneable interface?
You work as a developer for PassGuide Inc. You have implemented a session bean with a method doPrint(), which behaves differently depending on the caller's security role. Only MANAGER in the security roles "ADMIN" and "MANAGER" are allowed to call the method. Which of the following actions are appropriate to accomplish if there is no security-related metadata in the deployment descriptor?
Each correct answer represents a complete solution. Choose all that apply.
Which of the following elements can be used to obtain a database connection?
Which of the following methods causes the currently executing thread object to temporarily pause and allow other threads to execute?
In which of the following locations the helper classes of a session bean class reside?
Which of the following statements are true?
Each correct answer represents a complete solution. Choose all that apply.
The deployment descriptor uses the __________ element to pass control to an error page when an exception is thrown.
Which of the following tags is used to include resources from within the same servlet container?
Which of the following is a mandatory sub-element of the
You work as a Programmer for InfoTech Inc. You write the following code.
1. public class InnerDemo{
2. public static void main(String[] args) {
3. Car c = new Car();
4. // insert code here
5. e.test();
6. }
7. }
8. class Car{
9. class Engine{
10. void test() {System.out.println("test"); }
11. }
12. }
Which of the following options should you add to line 4 so that the code compiles and produces the output "test"?
You have created a Java application that will retrieve and insert data into a database table. Which of the following objects will you use to pass the JDBC Driver to obtain a connection to the database server?
Which of the following rules must be followed while determining a class loader?
Each correct answer represents a complete solution. Choose all that apply.
Which of the following functions are performed by methods of the
HttpSessionActivationListener interface?
Each correct answer represents a complete solution. Choose all that apply.
Mark works as a Programmer for InfoTech Inc. He develops a Java application that uses the encryption and compression techniques. Which of the following interfaces will he use to control the serialization and deserialization processes?
You work as a Software Developer for BlueTech Inc. You create code using EJB 3.0. You want to ensure that each new record is checked for validation before it is inserted into the database. Which of the following callback methods will you use to write the logic for validation?
Which of the following statements is true about the Java synchronized keyword?
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?
You have written the following code snippet.
1. public class Read {
2. protected int ReadText(int x) { return 0; }
3. }
4. class Text extends Read {
5. /*insert code here*/
6. }
Which of the following methods, inserted independently at line 5, will compile?
Each correct answer represents a complete solution. Choose all that apply.
You work as a programmer for PassGuide.Inc. You have a session object named session1 with an attribute named Attribute1, and an HttpSessionBindingEvent object binding1 bound to session1.
Which of the following will be used to retrieve Attribute1?
Each correct answer represents a complete solution. Choose all that apply.
You work as a Software Developer for NewTech Inc. You write a bean class using Enterprise
JavaBeans 3.0. The class uses the @DeclareRoles ("ADMIN, HR, DBA, USER") annotation to declare the security roles. The class contains a method named showResult(). You want to ensure that the ADMIN role is granted privilege to the showResult() method. Moreover, if a role that is not allowed to access the method tries to call the method, an error message must be shown. Assuming that there is no security-related element in the deployment descriptor, which of the following will you use to accomplish the task?
Each correct answer represents a part of the solution. Choose two.
Which of the following