exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 7 discussion

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

Given:

And given the code fragment:

What is the result?

  • A. 4W 100 Auto 4W 150 Manual
  • B. null 0 Auto 4W 150 Manual
  • C. Compilation fails only at line n1
  • D. Compilation fails only at line n2
  • E. Compilation fails at both line n1 and line n2
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

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
vic88
1 week, 6 days ago
Selected Answer: A
4W 100 Auto 4W 150 Manual
upvoted 1 times
...
9de58b9
7 months ago
Selected Answer: A
Tested
upvoted 1 times
...
andradaradu
1 year, 1 month ago
Selected Answer: E
It is going to complain you're not overriding the parent constructor. Answer's E.
upvoted 1 times
...
arjunrawatirissoftware
1 year, 2 months ago
Answer -A
upvoted 1 times
...
a_really_reliable_programmer
1 year, 3 months ago
Selected Answer: A
Tested.
upvoted 2 times
a_really_reliable_programmer
1 year, 3 months ago
class Vehicle { String type = "4w"; int maxSpeed = 100; Vehicle(String type, int maxSpeed) { this.type = type; this.maxSpeed = maxSpeed; } Vehicle() {} } class Car extends Vehicle { String trans; Car (String trans) { //line n1 this.trans = trans; } Car(String type, int maxSpeed, String trans) { super(type, maxSpeed); // line n2 this.trans = trans; } } public class q7 { public static void main(String[] args) { Car c1 = new Car ("Auto"); Car c2 = new Car ("4W", 150, "Manual"); System.out.println(c1.type + " "+ c1.maxSpeed + " " + c1.trans); System.out.println(c2.type +" " +c2.maxSpeed + " "+c2.trans); } }
upvoted 3 times
...
...
mbns
1 year, 4 months ago
Who determines that the correct anwers is E? It is obviously A. I have tested.
upvoted 2 times
swgreen
3 months, 3 weeks ago
Yes, answer is A. Java makes implicit call to 'super()'.
upvoted 1 times
...
...
samarrrr
1 year, 7 months ago
instance variable can be inhertited , if the subclass dosent have the value ( variable ) the default it s not 0 or null , it s her superclass values
upvoted 2 times
...
mrstevebang
1 year, 7 months ago
Selected Answer: A
My answer is A
upvoted 1 times
...
Vicky_65
1 year, 8 months ago
Selected Answer: A
Answer is A
upvoted 1 times
...
miankita
1 year, 11 months ago
Answer is A. Child class constructors automatically called parent class one.
upvoted 4 times
...
willokans
2 years ago
Answer is A No compilation fail c1.type and c1.maxSpeed have default values assinged to them in the Vehicle class. calling c1.type will fetch the Vehicle.typevalue of "4W" calling c1.maxSpeed will fetch the Vehicle.maxSpeed value of 100
upvoted 2 times
...
carloswork
2 years, 1 month ago
Selected Answer: A
Answer is A. To test: package teste; class Vehicle{ String type = "4W"; int maxSpeed = 100; Vehicle(String type, int maxSpeed){ //Construtor da classe Pai this.type=type; this.maxSpeed=maxSpeed; } Vehicle(){} // Construtor Default } // fim da classe Vehicle public class Car extends Vehicle{ String trans; Car(String trans){ //line n1 this.trans = trans; } Car(String type, int maxSpeed, String trans){ super(type, maxSpeed); //line n2 this.trans = trans; } public static void main(String[] args) { Car c1=new Car("Auto"); Car c2=new Car("4W", 150, "Manual"); System.out.println(c1.type + " " +c1.maxSpeed + " " + c1.trans); System.out.println(c2.type + " " +c2.maxSpeed + " " + c2.trans); } // Fim da main } // Fim da class Car
upvoted 3 times
...
Def8
2 years, 1 month ago
Selected Answer: A
No compilation errors. Answer is A.
upvoted 2 times
...
RoxyFoxy
2 years, 2 months ago
Selected Answer: A
No compilation errors. I tested the code and the correct answer is A: "super()" and "this" were used correctly in the constructors.
upvoted 4 times
...
kkaayyyy
2 years, 3 months ago
Answer is A
upvoted 1 times
...
Ancient1
2 years, 3 months ago
Selected Answer: A
Answer: A Tested: Yes Notes: No issue of compilation in this case. Both c1 and c2 are calling super constructors (c1 is using an implicit call), which are defined properly.
upvoted 2 times
...
Philip0908
2 years, 3 months ago
Selected Answer: A
This should be A!
upvoted 3 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