Free Cheat-test Samples and Demo Questions Download
Adobe exams Adobe
Apple exams Apple
Avaya exams Avaya
Check Point exams Check Point
Cisco exams Cisco
Citrix exams Citrix
CIW exams CIW
CompTIA exams CompTIA
CWNP exams CWNP
EC-Council exams EC-Council
EMC exams EMC
Exin exams Exin
Fortinet exams Fortinet
GIAC exams GIAC
Hitachi exams Hitachi
HP exams HP
IBM exams IBM
Isaca exams Isaca
ISC exams ISC
ISEB exams ISEB
Juniper exams Juniper
LPI exams LPI
McAfee exams McAfee
Microsoft exams Microsoft
Oracle exams Oracle
PMI exams PMI
Riverbed exams Riverbed
SNIA exams SAP
Sun exams SAS
Symantec exams Symantec
VMware exams VMware
All certification exams

Sun 310-081 Exam - Cheat-Test.com

Free 310-081 Sample Questions:

1.Under what two circumstances is the set JspBody method NOT called in a tag class that implements the Simple Tag interface? (Choose two)
A. The tag is invoked without a body.
B. The doTAb method throws an exception.
C. The <body-content> element has the value empty.
D. The tag is called with the attribute skip-body=true
Answer: A, C

2.Which two statements are true? (Choose two.)
A. An inner class may be declared as static.
B. An anonymous inner class can be declared as public.
C. An anonymous inner class can be declared as private.
D. An anonymous inner class can extend an abstract class.
E. An anonymous inner class can be declared as protected.
Answer: A, D

3.Which statements about static inner classes is true?
A. An anonymous class can be declared as static.
B. A static inner class cannot be a static member of the outer class.
C. A static inner class does not require an instance of the enclosing class.
D. Instance member of a static inner class can be referenced using the class name of the static inner class.
Answer: C

4.Which two method declarations are valid for an interface.? (Choose two)
A. Public double methoda():
B. static void methoda(double d1)
C. public final double methoda ();
D. abstract public void methoda ();
E. protected void methoda(double d1);
Answer: A, D

5.
1. package foo;
2.
3. import java.util.Vector
4.
5. private class My Vector extends Vector {
6. Int i = 1'
7. public MyVector () {
8. i = 2;
9. }
10. }
11.
12. public class My New Vector extends my Vector {
13. public MyNew Vector () {
14. i = 4;
15. }
16. public static void main (String args []) {
17. MyVector v = new My New Vector ();
18. }
19.
}
What is the result?
A. Compilation will succeed.
B. Compilation will fail at line 5.
C. Compilation will fail at line 6.
D. Compilation will fail at line 14.
E. Compilation will fail at line 176.
Answer: B

6.Which four types of object can be thrown using the throw statement? (Choose four.)
A. Error
B. Event
C. Object
D. Exception
E. Throwable
F. Runtime Exception
Answer: A, D, E, F

7. Given:
1. public class Foo
{
2. public static void main (String [] args)
{
3. try { System.exit (0);
}
4. finally { System.out.printIn("Finally"):
}
5.
}
6.
}
What is the result?
A. the program runs and prints nothing.
B. The program runs and prints "Finally".
C. The code compiles. But an exception is thrown at runtime.
D. the code will not compile because the catch block is missing.
Answer: A

8.Given:
1. Public class While Foo}
2. public static void main (Straing[] args)
{
3. int x = I, y =
6
4. while ( y--) {x++:
}
5. System, out. printIn ("x = " + x + " y = " + y)
:
6.
{
7.
{
What is the result?
A. The output is X = 6 y = 0
B. The output is x = 7 y = 0
C. The output is x = 6 y = -1
D. The output is x = 7 y = -1
E. Compilation will fail.
Answer: E
9
Given:
6. <my Tag:foo bai = 42>
7. <%=" processing"%>
8. </my Tag.foo>
And a custom tag handler for foo which extends Tag Support.
Which two are true about the tag handler referneed by my Tag. (Choose two.)
A. The do Start Tag method is called once.
B. The do After Body method is NOT called.
C. The EVAL_Page constant is a valid return value for the do End Tag Method.
D. the EVAL_BODY_BUFFERED constant is a valid return value for the do Start Tag method.
Answer: A, C

10.Given
11. Public void services (Servlet Request request,
12. Servlet Response response)
13. throws 10 Exccption
{
14. Servlet Context cxt = get Servlet Config ().get Servlet Context ()
:
15. Input Stream in
=
16. insert code here
17.
{
Which statement. At line 16, retrieves an Input Stream for the file / WEBINF/
myresrc.bin?
A. ctx.get put Stream ("/WEB-INF/myresrc.bin"):
B. ctx.get Input Stream ("/WEB-INF/myresrc.bin"):
C. ctx.get Resource As Stream ("/WEB-INF/myresrc.bin"):
D. new Input Stream (new Url ("/WEB-INF/myresrc.bin"):
E. Get Class (). Get Resource As Stream ("/WEB-INF/myresrc.bin"):
Answer: C

11.Given an HttpServlet Request request and Http Servlet Response response, which sets a cookie "username" with the value "joe" in a servlet.?
A. request.add Cookie ("username". "joe")
B. request.set Cookie ("username, "joe")
C. response.add Cookie (username", "joe"))
D. request.add Header (new Cookie ("username", "joe"))
E. request.add Cookie (new Cookie ("username", "joe"))
F. response.add Cookie (new Cookie ("username", "joe"))
G. response.add Header (new Cookie ("username", "joe"))
Answer: F

12.Given:
10. public void service Servlet Request request.
11. Servlet Response response)
{
12. ServletInput Stream sis=
13. //insert code here
14.
}
Which retrieves the binary input stream on line 13?
A. request.get Writer ():
B. request.get Reader ():
C. request.get Input Stream():
D. request.get Resource As Stream():
E. request.get Resource As Stream (Servlet Request. REQUEST):
Answer: C

13
Which HTTP method represents a request for information about the supported methods on an HTTP server?
A. GET
B. INFO
C. HEAD
D. TRACE
E. OPTIONS
Answer: E

14.Given:
1. public class Test
{
2. public static void main (String [] args)
{
3. unsigned byte b = 0;
4. b--
:
5.
6.
}
7.
}
What is the value of b bat line 5?
A. -1
B. 225
C. 127
D. Compilation will fail.
E. Compilation will succeed but the program will throw an exception at line 4.
Answer: D

15.Given
1. public class Test
{
2. public static void main (String[] args)
{
3. String foo = args [0]
;
4. String bar = args [1]
;
5. String baz = args [2]
;
6.
}
7.
}
And command line is vacation: Java Test red green blue
What is the Result?
A. baz has the value of "".
B. baz has the value of null.
C. baz has the value of "red"
D. baz has the value of "blue"
E. baz has the value of "green"
F. The code does not compile.
G. the program throws an exception.
Answer: D

16.Given:
1. //Point
X
2. public class Foo
{
3. public static void main (String [] args) throws Exception
{
4. Print Writer out = new Print Writer (new
5. java.io.Output Stream Writer (System.out), true)
;
6. out.printIn ("Hello"
)
7.
}
8.
}
Which statement at Point X on line 1 allows this code to compile and run?
A. import java.io.PrintWtier;
B. include java.io.PrintWRiter;
C. import java.io.OutputStream Writer;
D. include java.io.OutputStream Writer;
E. No statement is needed.
Answer: A


© 2014 Cheat-Test.com, All Rights Reserved