exam questions

Exam 1z0-808 All Questions

View all questions & answers for the 1z0-808 exam

Exam 1z0-808 topic 1 question 145 discussion

Actual exam question from Oracle's 1z0-808
Question #: 145
Topic #: 1
[All 1z0-808 Questions]

Given this segment of code:

Which two statements, if either were true, would make the code compile? (Choose two.)

  • A. MotorCycle is an interface that implements the Cycle class.
  • B. Cycle is an interface that is implemented by the MotorCycle class.
  • C. Cycle is an abstract superclass of MotorCycle.
  • D. Cycle and MotorCycle both extend the Transportation superclass.
  • E. Cycle and MotorCycle both implement the Transportation interface.
  • F. MotorCycle is a superclass of Cycle.
Show Suggested Answer Hide Answer
Suggested Answer: BC 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
MPignaProTech
2 months, 3 weeks ago
Selected Answer: BC
BC is the good answer
upvoted 1 times
...
Sisar
4 months, 2 weeks ago
Selected Answer: BC
BC are correct.
upvoted 1 times
...
duydn
1 year, 4 months ago
Selected Answer: BC
BC are correct.
upvoted 2 times
...
dsms
1 year, 5 months ago
Selected Answer: BE
B. Cycle is an interface that is implemented by the MotorCycle class. E. Cycle and MotorCycle both implement the Transportation interface. Explanation: B. Cycle is an interface that is implemented by the MotorCycle class. If Cycle is an interface and MotorCycle is a class that implements that interface, the code can compile successfully. E. Cycle and MotorCycle both implement the Transportation interface. If both Cycle and MotorCycle classes implement the Transportation interface, the code can compile successfully.
upvoted 1 times
dsms
1 year, 5 months ago
The other options are not valid based on the typical Java class hierarchy and interface implementation rules: A. MotorCycle is an interface that implements the Cycle class. This is not a valid Java syntax. An interface cannot implement a class. C. Cycle is an abstract superclass of MotorCycle. This is not the usual relationship between an interface and a class in Java. Interfaces are implemented, and classes are extended. D. Cycle and MotorCycle both extend the Transportation superclass. This is not mentioned in the code or the question, and there's no indication of a "Transportation" superclass. F. MotorCycle is a superclass of Cycle. This is not the typical relationship between an interface and a class in Java. Interfaces are not superclass/subclass relationships.
upvoted 1 times
...
...
UAK94
2 years, 3 months ago
BC are correct
upvoted 2 times
...
iSnover
2 years, 3 months ago
Selected Answer: C
The correct answer is CD, I'll give you a tip to get questions about inheritance right. Always think that a Father can be a son but a son cannot be a father. With that in mind let's solve the questions: A -> Wrong, Motocycle cannot implement Cycle, otherwise the code would be wrong because we call Motocycle type object inside cycle. B -> That's correct, Cycle can be an interface and a variable can be an interface and since MotorCycle implements Cycle it is a child of Cycle. C -> You are correct, Cycle can be a superclass of Motorcycle. D and E -> If they are extending or implementing the same class, they are not parent and child of each other then they are wrong. F -> Remember the tip I gave? Well, a son cannot be a father.
upvoted 2 times
iSnover
2 years, 3 months ago
I meant that the correct ones are BC*
upvoted 4 times
...
...
alex_au
2 years, 3 months ago
A cannot be true as we cannot instantiate an interface (MotorCycle)
upvoted 1 times
...
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.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago