You work as a Software Developer for UcTech Inc. You build an online book shop, so that users can purchase books using their credit cards. You want to ensure that only the administrator can access the credit card information sent by users. Which security mechanism will you use to accomplish the task?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Identify whether the given statement is true or false. "An object becomes eligible for garbage collection when it becomes unreachable by any code."
-
A
-
B
Reveal answer details
Close answer details
Mark works as a Programmer for InfoTech Inc. He develops an application named JavaServices. He wants to declare a security constraint that will restrict everything in the com/files directory so that security role of Admin can invoke any http methods on the resources. Which of the following element declarations will be used to accomplish the task?
-
A
<security-constraint><web-resource-collection><web-resource-name>JavaServices</web-resource- name><url-pattern>com/files</url-pattern></web-resource-collection><auth-constraint><role- name>Admin</role-name></auth-constraint></security-constraint>
-
B
<security-constraint><web-resource-collection><web-resource-name>JavaServices</web-resource- name><location>com/files/*</location></web-resource-collection><user-data-constraint><role- name>Admin</role-name></user-data-constraint></security-constraint>
-
C
<security-constraint><web-resource-collection><web-resource-name>JavaServices</web-resource- name><location>com/files/*</location><http-method>*</http-method></web-resource- collection><auth-constraint><role-name>Admin</role-name></auth-constraint></security-constraint>
-
D
<security-constraint><web-resource-collection><web-resource-name>JavaServices</web-resource- name><url-pattern>com/files/*</url-pattern></web-resource-collection><auth-constraint><role- name>Admin</role-name></auth-constraint></security-constraint>
Reveal answer details
Close answer details
Harry works as a Software Developer for SoftTech Inc. He has developed a Java application to perform various SQL statements such as INSERT, UPDATE, etc., against a database table named Employee. He has used the executeUpdate() method to perform various SQL queries and to know the exact affected rows in the database if any of the operations is performed against the database table. Which of the following types of values is returned by this method?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 5
Multiple choice
Which of the following methods are used to customize object serialization so that the objects will be able to apply default serialization? Each correct answer represents a complete solution. Choose two.
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Which of the following statements is true about the Java synchronized keyword?
-
A
It prevents multiple threads from accessing a block of code at the same time.
-
B
It allows the class to be loaded as soon as the JRE starts.
-
C
It prevents multiple developers from code redundancy.
-
D
It allows two different functions to execute in a shared manner.
Reveal answer details
Close answer details
Which of the following attribute scopes does not exist for a Servlet?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Which of the following exceptions will be thrown if the caller does not have permission to invoke the doAsPrivileged method?
-
A
-
B
-
C
-
D
PrivilegedActionException
Reveal answer details
Close answer details
Which of the following methods performs the authentication of subject and, if successful, associates Principals and Credentials with the authenticated Subject?
-
A
The getSubject() method of the LoginContext class
-
B
The login() method of the LoginModule interface
-
C
The login() method of the LoginContext class
-
D
The initialize() method of the LoginModule class
Reveal answer details
Close answer details
Question 10
Single choice
Mark works as a Programmer for InfoNet Inc. He writes the following programs. 1. package book; 2. public class read 3. { 4. (access modifier) int r1=10; 5. } 1. package book1; 2. import book.read; 3. class Doread extends read 4. { 5. public void test() 6. { 7. System.out.println("The value of r1 is." +r1); 8. } 9. } Which of the following access modifiers will be put in the place of the word, (access modifier), to compile the program successfully?
-
A
-
B
-
C
-
D
-
E
Reveal answer details
Close answer details
Question 11
Multiple choice
Which of the following statements about a JAR file are true? Each correct answer represents a complete solution. Choose all that apply.
-
A
It cannot be accessed through a class path, nor they can be used by java and javac.
-
B
It is used to compress and archive data.
-
C
It can be moved from one computer to another.
-
D
It is created by using the jar command.
Reveal answer details
Close answer details
Question 12
Single choice
Samantha works as a Software Developer for Bluetech Inc. She develops a class Warden that needs to access the Hostel class. The Hostel class is deployed in a JAR named City.JAR. What should be done so that during compilation the Warden class has access to the Hostel class?
-
A
The JAR file should be located in $ JAVA_HOME/jre/classes/City.JAR.
-
B
The JAR file should be located in javaprog/City.JAR and the class path environment should be set to include javaprog/City.JAR/Hostel.class.
-
C
The JAR file should be located in $ JAVA_HOME/jre/lib/ext/City.JAR.
-
D
The JAR file should be located in javaprog/City.JAR and the class path environment should be set to include javaprog/City.JAR/Warden.class.
Reveal answer details
Close answer details
Question 13
Single choice
Which of the following symbols is used to designate a named input parameter?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 14
Single choice
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?
-
A
-
B
-
C
-
D
jar -cf TestJar.jar testApp
Reveal answer details
Close answer details
Question 15
Multiple choice
Mark works as a Programmer for InfoTech Inc. He develops a Website that uses HTML and processes HTML validation. Which of the following are the advantages of the HTML application? Each correct answer represents a complete solution. Choose all that apply.
-
A
It provides password protection for a Web page or directory
-
B
It can be accessed by more visitors.
-
C
It provides faster loading.
-
D
It is easier to update and maintain the site.
-
E
It protects the source or images of a HTML Web page.
-
F
It puts less load on the server.
Reveal answer details
Close answer details
Correct answersB, C, D, F
Question 16
Single choice
Which of the following roles will release a servlet instance for garbage collection after the destroy method completes?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 17
Single choice
Which of the following elements can be used to obtain a database connection?
-
A
-
B
-
C
-
D
-
E
Reveal answer details
Close answer details
Question 18
Single choice
You work as a Software Developer for UcNet Inc. You write the following code using Java. class StringTest { public static void main(String args[]) { String s = "Hi"; concat("There"); System.out.println(s); } } What will happen when you try to compile and execute the code?
-
A
-
B
It will compile and execute successfully and will display Hi as the output.
-
C
It will compile but will throw an exception at runtime.
-
D
It will compile and execute successfully and will display HiThere as the output.
Reveal answer details
Close answer details
Question 19
Single choice
In which of the following directories will files be searched when the classpath is specified by the syntax below.-classpath uc\JavaFiles\NewFiles;uc\ServletFiles;.;
-
A
The current directory, the NewFiles directory, and the ServletFiles directory
-
B
The current directory, the uc directory, the NewFiles directory, and the ServletFiles directory
-
C
The current directory, the uc directory, the JavaFiles directory, the NewFiles directory, and the ServletFiles directory
-
D
The uc directory, the JavaFiles directory, the NewFiles directory, and the ServletFiles directory
Reveal answer details
Close answer details
Question 20
Single choice
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?
-
A
It will not compile because the Double class does not contain the toHexString() method.
-
B
It will compile and execute successfully and will display 8p312 as the output.
-
C
It will compile and execute successfully and will display 0x1.8p312.0 as the output.
-
D
It will not compile because the Double class does not contain the toString() method.
Reveal answer details
Close answer details
Question 21
Single choice
Which of the following exceptions will be thrown by the getFeature() method if the feature value cannot be assigned or retrieved?
-
A
-
B
-
C
-
D
SAXNotRecognizedException
Reveal answer details
Close answer details
Question 22
Single choice
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" %>
Reveal answer details
Close answer details
Question 23
Multiple choice
Which of the following methods are overridden by the FileInputStream class? Each correct answer represents a complete solution. Choose all that apply.
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 24
Single choice
Which of the following access modifiers is allowed for the constructor for a session bean class?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 25
Multiple choice
Which of the following methods of the HttpServletResponse interface is used for URL rewriting? Each correct answer represents a complete solution. Choose all that apply.
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 26
Multiple choice
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.
-
A
private int ReadText(long x) { return 0; }
-
B
protected long ReadText(int x, int y) { return 0; }
-
C
protected long ReadText(long x) { return 0; }
-
D
protected int ReadText(long x) { return 0; }
-
E
private int ReadText(int x) { return 0; }
-
F
public int ReadText(int x) { return 0; }
-
G
protected long ReadText(int x) { return 0; }
Reveal answer details
Close answer details
Correct answersA, B, C, D, F
Question 27
Single choice
Which of the following data type values is returned by the System.in.read() console input function?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 28
Single choice
Which of the following is a mandatory sub-element of the <web-resource-collection> element of the deployment descriptor?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 29
Single choice
Which of the following methods of the java.util.logging package logs a message, specifying source class and method, with associated Throwable information?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 30
Single choice
Which of the following listeners causes an object of the implementing class to be notified when it is added to or removed from a session?
-
A
-
B
HttpSessionActivationListener
-
C
HttpSessionAttributeListener
-
D
HttpSessionBindingListener
Reveal answer details
Close answer details
Question 31
Single choice
Which of the following data type values is returned by the System.in.read() console input function?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 32
Single choice
Which of the following will be returned by the expression "string" instanceof String?
-
A
-
B
-
C
-
D
-
E
-
F
Reveal answer details
Close answer details
Question 33
Single choice
Which of the following mechanisms is closely related to authorization?
-
A
Sending data so that no one can alter it on the way.
-
B
Allowing access to a particular resource.
-
C
Verifying username and password.
-
D
Sending secret data such as credit card information.
Reveal answer details
Close answer details
Question 34
Single choice
The __________ interface accepts results from a SQL SELECT statement.
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 35
Single choice
Which of the following options directs the Java compiler to search files in the current directory?
-
A
-
B
-
C
-
D
-
E
Reveal answer details
Close answer details
Question 36
Single choice
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); } }
-
A
-
B
It will display Helbyelo.
-
C
-
D
It will generate a compile-time error.
Reveal answer details
Close answer details
Question 37
Single choice
Mark works as a Programmer for InfoTech Inc. He develops the following deployment descriptor code. <web-app> <error-page> <exception-type>java.lang.Throwable</exception-type> <location> Error.jsp </location> </error-page> <error-page> <exception-type> javax.security.auth.RefreshFailedException</exception-type> <location> RefreshFailed.jsp </location> </error-page> </web-app> Which of the following statements is true about the deployment descriptor code given above?
-
A
It is not possible to declare two error-page code in the web-app element.
-
B
The error-page element does not belong to the web-app element.
-
C
Any exception other than RefreshFailedException will display the Error.jsp page.
-
D
All exceptions will display the Error.jsp page.
Reveal answer details
Close answer details
Question 38
Single choice
Consider the given lines of codE. package ucert class memberaccess { public int mem = 10; } Which of the following can directly access the variable mem?
-
A
-
B
Any class that extends the memberaccess class
-
C
Only the memberaccess class
-
D
Any class in the package ucert
Reveal answer details
Close answer details
Question 39
Single choice
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?
-
A
The code will compile and print false.
-
B
The code will compile, but it will not execute.
-
C
The code will compile and print true.
-
D
The code will not compile.
Reveal answer details
Close answer details
Question 40
Single choice
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 <entity> element of the deployment descriptor. 1. <security-role-ref> 2. The HR-Manager will have permission to access all the methods. 3. <role-name>HR-Manager</role-name> 4. 5. </security-role-ref> Bob wants to ensure that HR-Manager declared in the deployment descriptor should have all the privileges of an administrator. Which of the following elements should Bob declare in line 4 while deploying the bean?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 41
Multiple choice
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.
-
A
Annotate method doPrint() with @RolesAllowed({"ADMIN","MANAGER"}).
-
B
Annotate method doPrint() with @PermitAll.
-
C
If EJBContext.isCallerInRole("ADMIN") returns true, implement the behavior defined for MANAGER in role "ADMIN".
-
D
If EJBContext.getCallerPrincipal returns role "ADMIN", implement the behavior for MANAGER in role ADMIN.
Reveal answer details
Close answer details
Question 42
Multiple choice
Which of the following statements are true? Each correct answer represents a complete solution. Choose all that apply.
-
A
An inner class cannot be defined as private.
-
B
An inner class cannot be defined as protected.
-
C
An inner class can be defined as private.
-
D
An inner class can extend another class.
Reveal answer details
Close answer details
|