Mark works as a Programmer for InfoTech Inc. He develops the following code snippet.
1. public class Garbage
2. {
3. public static void main(String args[])
4. {
5. String line;
6. String first="it is a program";
7. String last="last argument";
8. String arg1=new String((args.length>0) ? "'" + args[0] + "'" . "no arguments");
9. line=arg1;
10. arg1=null;
11. line=first + line + last;
12. first=null;
13. System.out.println("line");
14. line=null;
15. last=null;
16. args=null;
17. }
18. }
Which of the following statements about the code snippet is true when an object is initially referenced with arg1, and it is eligible for garbage collection?
Mark works as a Programmer for InfoTech Inc. He develops the following code snippet.
import java.util.*;
public class DemoSet{
public static void main(String[] args){
TreeSet
ts.add("Sunday");
ts.add("Friday");
ts.add("Wednesday");
ts.add("Sunday");
ts.add("Monday");
Iterator it = ts.iterator();
while(it.hasNext()){
System.out.print(it.next() + " ");
}
}
}
What will be the output when he tries to execute the given code snippet?
You work as a programmer for PassGuide.Inc. You want to create a servlet filter that stores all request headers to a database for all requests to the Web application's home page "/work.jsp". Which of the following HttpServletRequest methods allows you to retrieve all of the request headers?
Which of the following statements make a message-driven bean different from a session bean?
Each correct answer represents a complete solution. Choose all that apply.
Mark works as a Programmer for InfoTech Inc. He develops the following code for a Web application named JavaSecurity Application.
...
Which of the following will be the action of the container if the request is HttpServletRequest, and request.isUserInRole("Admin"); has been called in a servlet code?
Mary works as a Software Developer for ABC Solutions Inc. She writes the following code.
public class StringMethods {
public static void main(String[] args) {
String str = new String("abc");
str.concat("xyz");
StringBuffer strBuf = new StringBuffer(" 123");
strBuf.append(" no");
System.out.println(str + strBuf);}}
What will be the output when Mary tries to compile and execute the code?
You work as programmer for PassGuide.Inc. You have purchased a Web application named
SecureProgrammer that uses the programmatic authorization, and the security roles that are not used in your organization. Which of the following deployment descriptor elements must you use so that the SecureProgrammer application can work with your organization?
Mark works as a Programmer for InfoTech Inc. He creates an error page named
PageDoesNotExist.jsp. He wants to ensure that the PageDoesNotExist.jsp page will always be displayed if the server cannot find the requested page or if the request is for a page that does not exist on the server. Which of the following error-page code declarations will be used?
You work as a Software Developer for TechnoZen Inc. You create an application using Java. You define a method, named myMethod. You also define a class, named myClass, within myMethod.
Which of the following rules governs the access to the variables of the enclosing method?
Which of the following code fragments will compile without error?
Each correct answer represents a complete solution. Choose all that apply.
You work as a Software Developer for BlueWell Inc. Your team creates a Web site for online shopping.
All payments are made through credit cards. Hence, you want to ensure that the information transferred between the customers and your Web site is encrypted. Which of the following authentication mechanisms will you use to accomplish the task?
Which of the following statements are true about Vector and ArrayList?
Each correct answer represents a complete solution. Choose all that apply.
Mark works as a Programmer for InfoTech Inc. He wants to develop a JMS API application that is used as a messaging service application. He writes the following createSession() method.
session = connection.createSession(false, 2);
Which of the following statements are true about the syntax?
Each correct answer represents a complete solution. Choose all that apply.
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?
Which of the following are marker interfaces?
Each correct answer represents a complete solution. Choose all that apply.
Mark works as a Programmer for InfoTech Inc. He develops a RefreshFailed.jsp page for a servlet. He wants that the RefreshFailed.jsp page will be displayed when the
javax.security.auth.RefreshFailedException is thrown. Which of the following error-page deployment descriptor element declarations will be used?
Which of the following classes is an engine class that provides an opaque representation of cryptographic parameters?
Mark works as a Programmer for InfoTech Inc. He develops a Web application that takes input from users. Which of the following methods can be used by the client and server to validate the users input?
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?
For which of the following purposes is the AccessController class used?
Each correct answer represents a complete solution. Choose all that apply.
Mark works as a Programmer for InfoTech Inc. He develops the following deployment descriptor code for specifying the security roles for a Web application.
Which of the following are the valid
Each correct answer represents a complete solution. Choose all that apply.
Which of the following statements about exceptions in message-driven beans are true?
Each correct answer represents a complete solution. Choose two.
You work as a Software Developer for Developer Inc. You write the following code.
interface A {public boolean b = false;}
class C implements A {public static void main(String args[]) {b = true;System.out.println(b);}}
Which of the following will be the result, when you try to compile and execute the above code?
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?
Rachel works as a Software Developer for Vivanet Inc. She writes the following code using Java.
class catchexcp
{public static void metha()
{int x=4/0;System.out.print("Caught exception");}
public static void main(String args[])
{try{metha();}catch(ArithmeticException ae){System.out.print("Caught ArithmeticException");}finally{try{metha();}catch(ArithmeticException ae){System.out.print("ReCaught ArithmeticException");}}}}
What will happen when she tries to compile and execute the code?
Which of the following statements about the isUserInRole() method are true?
Each correct answer represents a complete solution. Choose all that apply.
Wilbert works as a Software Developer for Wintos Inc. He writes the following code.
1. public class tcf
2. {
3. public static void main(String[] args)
4. {
5. try
6. {
7. int x = 5 / 0;
8. System.exit(0);
9. }
10. catch(ArithmeticException e)
11. {
12. System.out.println("Within catch");
13. }
14. finally
15. {
16. System.out.println("Within finally");
17. }
18. }
19. }
What will happen when he tries to compile and execute the code?
You work as a Web Deployer for UcTech Inc. You write the
Who will have access to the application?
Mark works as a Programmer for InfoTech Inc. He develops the following security-constraint code.
//
//
Which of the following
Which of the following, in JDBC 2.0, are the sub interfaces of the Statement interface?
Each correct answer represents a complete solution. Choose two.
A security manager is an object that defines a security policy for an application. Which of the following is used by security managers to indicate security domains?
Which of the following statements about the isCallerInRole() method are true?
Each correct answer represents a complete solution. Choose all that apply.
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.
Which of the following methods is used to encrypt or decrypt data in a single step?
Which of the following methods must be implemented by each subclass of the Permission class to compare permissions?
Which of the following authentication flag values will force authentication to continue to proceed down the LoginModule list, irrespective of whether the LoginModule succeeds or fails?
Each correct answer represents a complete solution. Choose all that apply.
Which of the following code declarations are valid error-page declarations?
Each correct answer represents a complete solution. Choose all that apply.
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 work as a Software Developer for UcTech Inc. You want to write a filter that will implement the Filter interface. Which of the following methods will you use to accomplish the task?
Each correct answer represents a complete solution. Choose all that apply.
Which of the following statements about programmatic security are true?
Each correct answer represents a complete solution. Choose all that apply.
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?
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?
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"?
Which of the following web-resource element descriptions will be used if you want to restrict all URL's in the application and perform authentication for the http delete method?
Mark works as an Application Developer for XYZ Solutions Inc. He writes the following code.
public class TestDemo{public static void main(String[] args){
{try{int x =0;int d= 5/x;}catch(Exception ex){System.out.println("Exception");}
catch(ArithmeticException ae){System.out.println("Arithmetic Exception");}}}
What is the result when Mark tries to compile and execute the code?
What will be the output of the following code snippet?
class test22
{
public static void main(String args[])
{
String str= new String("Hello");
str.insert(3,"bye");
System.out.println(str);
}
}
Which of the following methods are overridden by the FileInputStream class?
Each correct answer represents a complete solution. Choose all that apply.
John works as a Programmer for Technostar Inc. He writes the following code using Java.
1. class WrapperClass{
2. public static void main(String[] argv){
3. String str2 = Double.toString(12);
4. String str1 = Double.toHexString(12);
5. System.out.println(str1+str2);
6. }
7. }
What will happen when John attempts to compile and execute the code?
Sam works as a Software Developer for Gentech Inc. He writes the following code.
1. class TryFinallyTest {
2. public static void main(String[] args) {
3. try {
4. int i=15/0;
5. System.out.println("Testing Try");
6. }
7. catch(ArithmeticException ae) {
8. System.out.println("Arithmetic exception");
9. }
10. System.out.println("Correct");
11. finally {
12. System.out.println("Must execute");
13. }
14. }
15. }
What will happen when he attempts to compile and execute the code?
Which of the following are advantages of client-side JavaScript?
Each correct answer represents a complete solution. Choose two.
Which of the following actions can you take to seal two packages, PackageA and PackageB, in the JAR file MyJar.jar?
Each correct answer represents a complete solution. Choose all that apply.
Which of the following statements correctly describe the features of the singleton pattern?
Each correct answer represents a complete solution. Choose all that apply.
Which of the following deployment descriptor elements must contain the
What will be the output of the following program?
class Stringtest
{
public static void main(String args[])
{
String s= "test";
s.concat("paper");
System.out.println(s);
}
}
Maria works as a Software Developer for Bluetech Inc. She develops a class named Warden that needs to access a class named Hostel, which is deployed in a JAR named City.JAR. What will she do in order to enable the Warden class to have access to the Hostel class during compilation?
Which of the following elements indicates which users in specified roles are permitted access to a resource collection?
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 annotations specifies the roles that are allowed to invoke a particular bean method?
In which of the following locations the helper classes of a session bean class reside?
Which of the following data type values is returned by the System.in.read() console input function?
Which of the following methods causes the currently executing thread object to temporarily pause and allow other threads to execute?
Which of the following statements about the String, StringBuffer, and StringBuilder classes are true?
Each correct answer represents a complete solution. Choose all that apply.
Which of the following methods throws a SecurityException if the calling thread is not allowed to open a socket connection to the specified host and port number?
Which of the following methods evaluates the global policy for the permissions granted to the
ProtectionDomain and tests whether the permission is granted?
Fill in the______blank with the required interface name to complete the statement below.
An object of the interface is provided by the container to invoke the next filter in a chain of filters.
Which of the following exceptions is thrown if a class uses the clone() method but does not implement the Cloneable interface?
Identify whether the given statement is true or false.
"An object becomes eligible for garbage collection when it becomes unreachable by any code."
Which of the following statements is used to enclose a block of code in which an exception is likely to occur?
Which of the following options directs the Java compiler to search files in the current directory?
Which of the following exceptions will be thrown if the name parameter is null in the constructor of AuthPermission?
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.
The deployment descriptor uses the __________ element to pass control to an error page when an exception is thrown.
Which of the following JDBC interfaces is described in the statement below?
"It provides support for executing SQL statements and stored procedures."
Which of the following statements about a JAR file are true?
Each correct answer represents a complete solution. Choose all that apply.