1z0-804 Actual Exam Questions

Last updated on Dec. 3, 2024.
Vendor:Oracle
Exam Code:1z0-804
Exam Name:Java SE 7 Programmer II
Exam Questions:150
 

Topic 1 - Single Topic

Question #1 Topic 1

Given:

Which three values will appear in the output?

  • A. 5
  • B. 7
  • C. a1
  • D. a2
  • E. b1
  • F. b2 ADE
Reveal Solution Hide Solution   Discussion  

Correct Answer: Explanation 🗳️
Static method of base class is invoked >>
A myA = new B();
System.out.print(myA.doA() + myA.doA2() + myA.a);
class B String doA() { return "b1 "; }
class A protected static String doA2 () { return "a2 "; }
class B int a = 7;

Question #2 Topic 1

Given:

What is the result?

  • A. false false
  • B. true false
  • C. true true
  • D. Compilation fails
  • E. An exception is thrown at runtime
Reveal Solution Hide Solution   Discussion  

Correct Answer: A 🗳️
(this == obj) is the object implementation of equals() and therefore FALSE, if the reference points to various objects and then the super.equals() is invoked, the object method equals() what still result in FALSE better override of equals() is to compare the attributes like: public boolean equals (Object obj) { if (obj != null){
Product p = (Product)obj;
return this.id == p.id;
}
return false;
}

Question #3 Topic 1

Given:

What is the result?

  • A. tolting cantering tolting
  • B. cantering cantering cantering
  • C. compilation fails
  • D. an exception is thrown at runtime
Reveal Solution Hide Solution   Discussion  

Correct Answer: C 🗳️
Compiler says: Cannot reduce the visibility of the inherited method from Rideable. mssen PUBLIC sein public String ride() { return "cantering "; } public String ride() { return "tolting "; } if this is given then the result would be:
A : tolting cantering tolting

Question #4 Topic 1

Which four are syntactically correct?

  • A. package abc; package def; import Java.util . * ; public class Test { }
  • B. package abc; import Java.util.*; import Java.util.regex.* ; public class Test { }
  • C. package abc; public class Test {} import Java.util.* ;
  • D. import Java.util.*; package abc; public class Test {}
  • E. package abc; import java.util. *; public class Test{}
  • F. public class Test{} package abc; import java.util.*{}
  • G. import java.util.*; public class Test{}
  • H. package abc; public class test {}
Reveal Solution Hide Solution   Discussion  

Correct Answer: BEGH 🗳️

file Viewing page 1 out of 38 pages.
Viewing questions 1-4 out of 150 questions
Next Questions
Browse atleast 50% to increase passing rate cup
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago