exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 8 discussion

Actual exam question from Oracle's 1z0-809
Question #: 8
Topic #: 1
[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? (Choose two.)

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

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
1 month, 4 weeks ago
Selected Answer: DF
DF is good
upvoted 1 times
...
asdfjhfgjuaDCV
10 months, 1 week ago
D and F is the correct answer
upvoted 1 times
...
steefaand
11 months, 1 week ago
Selected Answer: DF
D and F are correct since class Square doesnt have no-arg constructor because there is one desifned which takes argument and overriding method cant reduce method visibility.
upvoted 1 times
...
r1muka5
1 year, 10 months ago
Correct answer: D (class square does not have default constructor) and F (overriden method is less visible)
upvoted 2 times
...
Eden0516
2 years ago
Selected Answer: DF
Correct answer: D, F (Tested)
upvoted 1 times
...
WilsonKKerll
2 years, 10 months ago
Correct answer is D, F.
upvoted 1 times
...
Tarik2190
3 years, 8 months ago
Answer is D,F abstract class Shape { Shape () { System.out.println ("Shape"); } protected void area () { System.out.println ("Shape"); } } class Square extends Shape { int side; Square (int side){ this.side = side; } public void area ( ) { System.out.println ("Square"); } } class Rectangle extends Square { int len, br; Rectangle (int x, int y) { super(x); len = x; br = y; } public void area ( ) { System.out.println ("Rectangle"); } }
upvoted 4 times
...
bnagaraja9099
3 years, 8 months ago
Options: D,F
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