Free Oracle 1Z0-809 Exam Actual Questions

The questions for 1Z0-809 were last updated On Nov 17, 2024

Question No. 1

Given:

public interface Moveable {

public default void walk (Integer distance) {System.out.println(''Walking'');)

public void run(Integer distance);

}

Which statement is true?

Show Answer Hide Answer
Correct Answer: A

Question No. 2

Given:

Your design requires that:

fuelLevel of Engine must be greater than zero when the start() method is invoked.

The code must terminate if fuelLevel of Engine is less than or equal to zero.

Which code fragment should be added at line n1 to express this invariant condition?

Show Answer Hide Answer
Correct Answer: C

Question No. 3

Given the definition of the Vehicle class:

Class Vehhicle {

int distance;//line n1

Vehicle (int x) {

this distance = x;

}

public void increSpeed(int time) {//line n2

int timeTravel = time;//line n3

class Car {

int value = 0;

public void speed () {

value = distance /timeTravel;

System.out.println (''Velocity with new speed''+value+''kmph'');

}

}

new Car().speed();

}

}

and this code fragment:

Vehicle v = new Vehicle (100);

v.increSpeed(60);

What is the result?

Show Answer Hide Answer
Correct Answer: A

Question No. 4

Given:

class Book {

int id;

String name;

public Book (int id, String name) {

this.id = id;

this.name = name;

}

public boolean equals (Object obj) { //line n1

boolean output = false;

Book b = (Book) obj;

if (this.name.equals(b name))}

output = true;

}

return output;

}

}

and the code fragment:

Book b1 = new Book (101, ''Java Programing'');

Book b2 = new Book (102, ''Java Programing'');

System.out.println (b1.equals(b2)); //line n2

Which statement is true?

Show Answer Hide Answer
Correct Answer: A

Question No. 5

Given the code fragment:

List empDetails = Arrays.asList(''100, Robin, HR'',

''200, Mary, AdminServices'',

''101, Peter, HR'');

empDetails.stream()

.filter(s-> s.contains(''1''))

.sorted()

.forEach(System.out::println); //line n1

What is the result?

Show Answer Hide Answer
Correct Answer: A