Question No: 12 – (Topic 1)

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?

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

javac -classpath /practice/ Practice.java

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

javac -classpath /practice Practice.java

Answer: A

Question No: 13 – (Topic 1)

Which of the following statements is true?

All UTF characters are eight bits long.

All UTF characters are all sixteen bits long.

All UTF characters are twenty four bits long.

All bytecode characters are sixteen bits long.

All unicode characters are sixteen bits long.

Answer: E

Question No: 14 – (Topic 1)

John works as a Programmer for Technostar Inc. He writes the following code using Java.

class WrapperClass{

public static void main(String[] argv){

String str2 = Double.toString(12);

String str1 = Double.toHexString(12);

System.out.println(str1 str2); 6. }

7. }

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

It will not compile because the Double class does not contain the toHexString() method.

It will compile and execute successfully and will display 8p312 as the output.

It will compile and execute successfully and will display 0x1.8p312.0 as the output.

It will not compile because the Double class does not contain the toString() method.

Answer: C

Question No: 15 – (Topic 1)

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.

It provides password protection for a Web page or directory

It can be accessed by more visitors.

It provides faster loading.

It is easier to update and maintain the site.

It protects the source or images of a HTML Web page.

It puts less load on the server.

Answer: B,C,D,F

Question No: 16 – (Topic 1)

You have written the following code snippet.

public class Read {

protected int ReadText(int x) { return 0; } 3. }

class Text extends Read {

/*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.

private int ReadText(long x) { return 0; }

protected long ReadText(int x, int y) { return 0; }

protected long ReadText(long x) { return 0; }

protected int ReadText(long x) { return 0; }

private int ReadText(int x) { return 0; }

public int ReadText(int x) { return 0; }

protected long ReadText(int x) { return 0; }

Answer: A,B,C,D,F

Question No: 17 – (Topic 1)

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.

HttpSessionBindingListener

HttpSessionListener

HttpSessionActivationListener

HttpSessionAttributeListener

Answer: C,D

Question No: 18 – (Topic 1)

Which of the following statements are true?

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

An inner class cannot be defined as private.

An inner class cannot be defined as protected.

An inner class can be defined as private.

An inner class can extend another class.

Answer: C,D

Question No: 19 – (Topic 1)

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.

Object obj=binding1.getSession().getAttribute(quot;Attribute1quot;);

Object obj=binding1.getAttribute(quot;Attribute1quot;);

Long MyAttribute=session1.getAttribute(quot;Attribute1quot;);

String str1=session1.getAttribute(quot;Attribute1quot;);

Object obj=session1.getAttribute(quot;Attribute1quot;);

Answer: A,E

Question No: 20 – (Topic 1)

Which of the following statements about a JAR file are true?

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

It cannot be accessed through a class path, nor they can be used by java and javac.