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-035 Exam - Cheat-Test.com

Free 310-035 Sample Questions:

1. Given:
1. public class Outer{
2. public void someOuterMethod() {
3. // Line 3
4. }
5. public class Inner{ }
6. public static void main( String[]argv ) {
7. Outer o = new Outer();
8. // Line 8
9. }
10. }
Which instantiates an instance of Inner?
A.new Inner(); // At line 3
B.new Inner(); // At line 8
C.new o.Inner(); // At line 8
D.new Outer.Inner(); // At line 8
Answer: A

2. Click the Exhibit button.
1. interface Beta {}
2.
3. class Alpha implements Beta {
4. String testIt() {
5. return "Tested";
6. }
7. }
8.
9. public class Main1 {
10. static Beta getIt() {
11. return new Alpha();
12. }
13. public static void main( String[] args ) {
14. Beta b = getIt();
15. System.out.println( b.testIt() );
16. }
17. }
What is the result?
A.Tested
B.Compilation fails.
C.The code runs with no output.
D.An exception is thrown at runtime.
Answer: B

3. Given:
11. int i = 1, j = 10;
12. do {
13. if (i++ > --j) {
14. continue;
15. }
16. } while (i < 5);
17. System.out.println("i = " + i + " and j = " + j);
What is the result?
A.i = 6 and j = 5
B.i = 5 and j = 5
C.i = 6 and j = 4
D.i = 5 and j = 6
E.i = 6 and j = 6
Answer: D

4. Click the Exhibit button.
1. public class X {
2. public static void main(String [] args) {
3. try {
4. badMethod();
5. System.out.print("A");
6. }
7. catch (Exception ex) {
8. System.out.print("B");
9. }
10. finally {
11. System.out.print("C");
12. }
13. System.out.print("D");
14. }
15. public static void badMethod() {}
17. }
What is the result?
A.AC
B.BC
C.ACD
D.ABCD
E.Compilation fails.
Answer: C

5. Click the Exhibit button.
1. class A {
2. }
3. class Alpha {
4. private A myA = new A();
5.
6. void doIt( A a ) {
7. a = null;
8. }
9. void tryIt() {
10. doIt( myA );
11. }
12. }
Which two statements are correct? (Choose two.)
A.There are no instances of A that will become eligible for garbage collection.
B.Explicitly setting myA to null marks that instance to be eligible for garbage collection.
C.Any call on tryIt() causes the private instance of A to be marked for garbage collection.
D.Private instances of A become eligible for garbage collection when instances of Alpha become eligible for garbage collection.
Answer: B, D

6. Which two are valid method signatures in an interface declaration? (Choose two.)
A.void method1();
B.public void method2();
C.protected void method3();
D.final public void method4();
E.static public void method5();
Answer: A, B

7. Given:
11. int index = 1;
12. int[] foo = new int[3];
13. int bar = foo[index];
14. int baz = bar + index;
15. System.out.println(" baz = " + baz); What is the result?
A.baz = 0
B.baz = 1
C.baz = 2
D.Compilation fails.
E.An exception is thrown at runtime.
Answer: B

8. Which two are equal? (Choose two.)
A.3 / 2
B.3 < 2
C.3 * 4
D.3 << 2
E.3 * 2^2
F.3 <<< 2
Answer: C, D

9. Given:
11. boolean a = false;
12. boolean b = false;
13. boolean c = ((a = true) | (b = true));
14. System.out.println( a + ", " + b + ", " + c );
What is the result?
A.Compilation fails.
B.true, true, true
C.true, true, false
D.true, false, false
E.false, false, false
Answer: B

10. Given "B is a D" and "B has a C," which two statements are true? (Choose two.)
A.D refers to B.
B.B refers to D.
C.D refers to C.
D.B refers to C.
E.D inherits from B.
F.B inherits from D.
Answer: D, F

11. Given:
1. class EnclosingOne {
2. public class InsideOne { }
3. }
4. public class InnerTest {
5. public static void main(String[] args) {
6. EnclosingOne eo = new EnclosingOne();
7. // insert code here
8. }
9. }
Which statement at line 7 constructs an instance of the inner class?
A.InsideOne ei = eo.new InsideOne();
B.eo.InsideOne ei = eo.new InsideOne();
C.InsideOne ei = EnclosingOne.new InsideOne();
D.EnclosingOne.InsideOne ei = eo.new InsideOne();
Answer: D

12. Which statement is true?
A.To call the join() method, a thread must own the lock of the current thread.
B.To call the sleep() method, a thread must own the lock of the current thread.
C.To call the yield() method, a thread must own the lock of the current thread.
D.To call the notify() method, a thread must own the lock of the current thread.
E.To call the notify() method, a thread must own the lock of the object on which the call is to be made.
Answer: E

13. Given:
11. double d = Math.random(); Which is true about d after line 11?
A.d >= 1.0
B.0.0 <= d < 1.0
C.0.0 <= d < Double.MAX_VALUE
D.0.0 <= d <= Double.MAX_VALUE
E.Double.MIN_VALUE <= d < Double.MAX_VALUE
Answer: B

14. Given:
20. try {
21. Float f = Float.valueOf("12.9");
22. String s = f.toString();
23. int i = Integer.parseInt(s);
24. System.out.println("i = " + i);
25. }
26. catch (NumberFormatException x) {
27. System.out.println("Trouble");
28. }
What is the result?
A.i = 12
B.i = 13
C.Trouble
D.Compilation fails because of an error at line 21.
E.Compilation fails because of an error at line 23.
Answer: C

15. Which two create an instance of an array? (Choose two.)
A.int[] ia = new int[15];
B.float fa = new float[20];
C.char[] ca = "Some String";
D.Object oa = new float[20];
E.int ia[][] = { 4, 5, 6 }, { 1, 2, 3 };
Answer: A, D

16. Given:
1. public class ArrayTest {
2. public static void main(String[] args) {
3. float f1[], f2[];
4. f1 = new float[10];
5. f2 = f1;
6. System.out.println("f2[0] = " + f2[0]);
7. }
8. }
What is the result?
A.It prints f2[0] = 0.0.
B.It prints f2[0] = NaN.
C.An error at line 5 causes compile to fail.
D.An error at line 6 causes compile to fail.
E.An error at line 6 causes an exception at runtime.
Answer: A

17. Which two cause a compiler error? (Choose two.)
A.int[] scores = {3, 5, 7};
B.int [][] scores = {2,7,6}, {9,3,45};
C.String cats[] = {"Fluffy", "Spot", "Zeus"};
D.boolean results[] = new boolean [3] {true, false, true};
E.Integer results[] = {new Integer(3), new Integer(5), new Integer(8)};
F.String[] dogs = new String[]{new String("Fido"),new String("Spike"),new String("Aiko")};
Answer: B, D

18. Which three form part of correct array declarations? (Choose three.)
A.public int a []
B.static int [] a
C.public [] int a
D.private int a [3]
E.private int [3] a []
F.public final int [] a
Answer: A, B, F

19. Which two cause a compiler error? (Choose two.)
A.float[] f = new float(3); B.float f2[] = new float[]; C.float[] f1 = new float[3]; D.float f3[] = new float[3];
E.float f5[] = { 1.0f, 2.0f, 2.0f };
F.float f4[] = new float[] { 1.0f, 2.0f, 3.0f };
Answer: A, B

20. Given:
12. float f[][][] = new float[3][][];
13. float f0 = 1.0f;
14. float[][] farray = new float[1][1]; Which is valid?
A.f[0] = f0;
B.f[0] = farray;
C.f[0] = farray[0];
D.f[0] = farray[0][0];
Answer: B


© 2014 Cheat-Test.com, All Rights Reserved