exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 76 discussion

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

Given the following classes:

Which two options fail to compile when placed at line n1 of the main method? (Choose two.)

  • A. employee.salary = 50_000;
  • B. director.salary = 80_000;
  • C. employee.budget = 200_000;
  • D. manager.budget = 1_000_000;
  • E. manager.stockOption = 500;
  • F. director.stockOptions = 1_000;
Show Suggested Answer Hide Answer
Suggested Answer: CE 🗳️

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
DarGrin
3 months, 1 week ago
Selected Answer: CE
C and E are correct
upvoted 1 times
...
ManuTov
4 months, 3 weeks ago
Since budget is a member variable declared in the Manager class (subclass), instances of the Employee class (superclass) cannot directly access or modify the budget variable. And stockOption does not exit.
upvoted 1 times
...
Vicky_65
9 months, 2 weeks ago
Selected Answer: CE
CE are the invalid.
upvoted 1 times
...
carloswork
1 year, 2 months ago
Selected Answer: CE
Answer is CE. To test: class Employee { public int salary; } class Manager extends Employee { public int budget; } public class Director extends Manager { public int stockOptions; public static void main (String [] args ) { Employee employee = new Employee(); Manager manager = new Manager(); Director director = new Director(); employee.salary = 50_000; // A director.salary = 80_000; // B // employee.budget = 200_000; // C manager.budget = 1_000_000; // D // manager.stockOption = 500; // E director.stockOptions = 1_000; // F System.out.println(employee.salary); System.out.println(director.salary); // System.out.println(stockOptions); System.out.println(manager.budget); // System.out.println(manager.stockOption); System.out.println(director.stockOptions); } }
upvoted 1 times
...
kkaayyyy
1 year, 3 months ago
We cannot access variable budget by the object of employee and variable stockOptions by the object of manager as they lie in the child branch. Thus C and E are correct.
upvoted 1 times
...
shivkumarx
1 year, 3 months ago
This question is not written correctly, the actual questions references all the objects using the Employee class
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