exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 4 discussion

Actual exam question from Oracle's 1z0-809
Question #: 5
Topic #: 2
[All 1z0-809 Questions]

Given:
1. abstract class Shape {
2. Shape ( ) { System.out.println ("Shape"); }
3. protected void area ( ) { System.out.println ("Shape"); }
4. }
5.
6. class Square extends Shape {
7. int side;
8. Square int side {
9. /* insert code here */
10. this.side = side;
11. }
12. public void area ( ) { System.out.println ("Square"); }
13. }
14. class Rectangle extends Square {
15. int len, br;
16. Rectangle (int x, int y) {
17. /* insert code here */
18. len = x, br = y;
19. }
20. void area ( ) { System.out.println ("Rectangle"); }
21. }
Which two modifications enable the code to compile?
abstract

  • A. At line 1, remove super ( );
  • B. At line 9, insert public
  • C. At line 12, remove super (x);
  • D. At line 17, insert super (); super.side = x;
  • E. At line 17, insert public void area ( ) {
  • F. At line 20, use
Show Suggested Answer Hide Answer
Suggested Answer: CD 🗳️

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
steefaand
5 months, 4 weeks ago
Selected Answer: CF
C and F are correct.
upvoted 1 times
...
iSnover
5 months, 4 weeks ago
Selected Answer: CF
The answer is CF, in line 17 "insert super(x);" and in line 20 "insert public".
upvoted 1 times
...
WilsonKKerll
2 years, 4 months ago
- line 2, void Shape(){...} - line 17, Rectangle(int x, int y){super(x);....} - line 20, public void area() {....}
upvoted 1 times
...
Abdullah_Rahahleah
3 years, 7 months ago
super keywork is mandatory if the default constructor for the parent overloaded
upvoted 1 times
...
Pasci
4 years, 2 months ago
strange code at line 8, maybe shoud be: Square(int side) {...} then the correct change would be: - line 17: insert super(x); - line 20: insert public
upvoted 4 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