[Free] 2018(Jan) EnsurePass Examcollection Oracle 1z0-803 Dumps with VCE and PDF 81-90

Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-803
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-803.html

Java SE 7 Programmer I

Question No: 81

Given the code fragment:

class Student { int rollnumber; String name;

List cources = new ArrayList();

// insert code here public String toString() {

return rollnumber quot; : quot; name quot; : quot; cources;

}

}

And,

public class Test {

public static void main(String[] args) { List cs = newArrayList(); cs.add(quot;Javaquot;);

cs.add(quot;Cquot;);

Student s = new Student(123,quot;Fredquot;, cs); System.out.println(s);

}

}

Which code fragment, when inserted at line // insert code here, enables class Test to print 123 : Fred : [Java, C]?

  1. private Student(int i, String name, List cs) {

    /* initialization code goes here */

    }

  2. public void Student(int i, String name, List cs) {

    /* initialization code goes here */

    }

  3. Student(int i, String name, List cs) {

    /* initialization code goes here */

    }

  4. Student(int i, String name, ArrayList cs) {

/* initialization code goes here */

}

Answer: C Explanation: Incorrect:

Not A: Student has private access line: Student s = new Student(123,quot;Fredquot;, cs);

Not D: Cannot be applied to given types.Line: Student s = new Student(123,quot;Fredquot;, cs);

Question No: 82

Which declaration initializes a boolean variable?

  1. boolean h = 1;

  2. boolean k = 0;

  3. boolean m = null;

  4. boolean j = (1 lt; 5);

Answer: D Explanation:

The primitive type boolean has only two possible values: true and false. Here j is set to (1

lt;5), which evaluates to true.

Question No: 83

View the exhibit:

Ensurepass 2018 PDF and VCE

Ensurepass 2018 PDF and VCE

What is the result when this program is executed?

  1. Bob#39;s Name: Bob

  2. Bob#39;s Name: Jian

  3. Nothing prints

  4. Bob’s name

    Answer: B Explanation:

    After the statement jian = bob; the jian will reference the same object as bob.

    Question No: 84

    1. class StaticMethods {

    2. static void one() {

    3. two();

    4. StaticMethods.two();

    5. three();

    6. StaticMethods.four(); 7. }

  1. static void two() { }

  2. void three() {

  3. one();

  4. StaticMethods.two();

  5. four();

  6. StaticMethods.four();

14. }

15. void four() { }

16. }

Which three lines are illegal?

  1. line 3

  2. line4

  3. line 5

  4. line 6

  5. line 10

  6. line 11

  7. line 12

  8. line 13

Answer: C,D,H

Question No: 85

Given:

Ensurepass 2018 PDF and VCE

  1. Ym Xm2

  2. Ym Xm1

  3. Compilation fails

  4. A ClassCastException is thrown at runtime

Answer: B

Question No: 86

Given:

Ensurepass 2018 PDF and VCE

What is the reference type of myZ and what is the type of the object it references?

  1. Reference type is Z; object type is Z.

  2. Reference type is Y; object type is Y.

  3. Reference type is Z; object type is Y.

  4. Reference type is X; object type is Z.

Answer: C

Question No: 87

Which two are valid instantiations and initializations of a multi dimensional array?

Ensurepass 2018 PDF and VCE

  1. Option A

  2. Option B

  3. Option C

  4. Option D

  5. Option E

Answer: A,D

Question No: 88

Given:

public class ComputeSum { public int x;

public int y; public int sum;

public ComputeSum (int nx, int ny) { x = nx; y =ny;

updateSum();

}

public void setX(int nx) { x =nx; updateSum();} public void setY(int ny) { x = ny; updateSum();} void updateSum() { sum = x y;}

}

This class needs to protect an invariant on the sum field.

Which three members must have the private access modifier to ensure that this invariant is maintained?

  1. The x field

  2. The y field

  3. The sum field

  4. The ComputerSum ( ) constructor

  5. The setX ( ) method

  6. The setY ( ) method

Answer: C,E,F

Explanation: The sum field and the two methods (setX and SetY) that updates the sum field.

Question No: 89

Given:

public class Natural { private int i;

void disp() { while (i lt;= 5) {

for (int i=1; i lt;=5;) { System.out.print(i quot; quot;); i ;

} i ;

}

}

public static void main(String[] args) { new Natural().disp();

}

}

What is the result?

  1. Prints 1 2 3 4 5 once

  2. Prints 1 3 5 once

  3. Prints 1 2 3 4 5 five times

  4. Prints1 2 3 4 5 six times

  5. Compilation fails

Answer: D

Explanation: 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5

Question No: 90

Given the code fragment

Ensurepass 2018 PDF and VCE

Which code fragments, inserted independently, enable the code compile?

  1. t.fvar = 200;

  2. cvar = 400;

  3. fvar = 200; cvar = 400;

  4. this.fvar = 200; this.cvar = 400;

  5. t.fvar = 200; Test2.cvar = 400;

  6. this.fvar = 200; Test2.cvar = 400;

Answer: B

100% Ensurepass Free Download!
Download Free Demo:1z0-803 Demo PDF
100% Ensurepass Free Guaranteed!
Download 2018 EnsurePass 1z0-803 Full Exam PDF and VCE

EnsurePass ExamCollection Testking
Lowest Price Guarantee Yes No No
Up-to-Dated Yes No No
Real Questions Yes No No
Explanation Yes No No
PDF VCE Yes No No
Free VCE Simulator Yes No No
Instant Download Yes No No

Leave a Comment

(0 Comments)

Your email address will not be published. Required fields are marked *