Pass4itsure > Oracle > Oracle Database > 1Z0-809 > 1Z0-809 Online Practice Questions and Answers

1Z0-809 Online Practice Questions and Answers

Questions 4

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);

A. increSpeed(60); What is the result?

B. Velocity with new speed

C. A compilation error occurs at line n1.

D. A compilation error occurs at line n2.

E. A compilation error occurs at line n3.

Buy Now
Questions 5

Given:

public class Counter {

public static void main (String[ ] args) {

int a = 10;

int b = -1;

assert (b >=1) : "Invalid Denominator";

int = a / b;

System.out.println (c);

}

}

What is the result of running the code with the -ea option?

A. -10

B. 0

C. An AssertionError is thrown.

D. A compilation error occurs.

Buy Now
Questions 6

Given:

public final class IceCream {

public void prepare() {}

}

public class Cake {

public final void bake(int min, int temp) {}

public void mix() {}

}

public class Shop {

private Cake c = new Cake ();

private final double discount = 0.25;

public void makeReady () { c.bake(10, 120); }

}

public class Bread extends Cake {

public void bake(int minutes, int temperature) {}

public void addToppings() {}

}

Which statement is true?

A. A compilation error occurs in IceCream.

B. A compilation error occurs in Cake.

C. A compilation error occurs in Shop.

D. A compilation error occurs in Bread

E. All classes compile successfully.

Buy Now
Questions 7

Which statement is true about java.time.Duration?

A. It tracks time zones.

B. It preserves daylight saving time.

C. It defines time-based values.

D. It defines date-based values.

Buy Now
Questions 8

Given the code fragments:

class TechName {

String techName;

TechName (String techName) {

this.techName=techName;

}

}

and

List tech = Arrays.asList (

new TechName("Java-"),

new TechName("Oracle DB-"),

new TechName("J2EE-")

);

Stream stre = tech.stream();

//line n1

Which should be inserted at line n1 to print Java-Oracle DB-J2EE-?

A. stre.forEach(System.out::print);

B. stre.map(a-> a.techName).forEach(System.out::print);

C. stre.map(a-> a).forEachOrdered(System.out::print);

D. stre.forEachOrdered(System.out::print);

Buy Now
Questions 9

Given: What is the result?

A. Bar Hello Foo Hello

B. Bar Hello Baz Hello

C. Baz Hello

D. A compilation error occurs in the Daze class.

Buy Now
Questions 10

Given the code fragment:

What is the result?

A. Word: why what when

B. Word: why Word: why what Word: why what when

C. Word: why Word: what Word: when

D. Compilation fails at line n1.

Buy Now
Questions 11

Given:

class Student {

String course, name, city;

public Student (String name, String course, String city) {

this.course = course; this.name = name; this.city = city;

}

public String toString() {

return course + ":" + name + ":" + city;

}

public String getCourse() {return course;}

public String getName() {return name;}

public String getCity() {return city;}

and the code fragment:

List stds = Arrays.asList(

new Student ("Jessy", "Java ME", "Chicago"),

new Student ("Helen", "Java EE", "Houston"),

new Student ("Mark", "Java ME", "Chicago"));

stds.stream()

.collect(Collectors.groupingBy(Student::getCourse))

.forEach(src, res) -> System.out.println(scr));

What is the result?

A. A compilation error occurs.

B. Java EE Java ME

C. [Java EE: Helen:Houston] [Java ME: Jessy:Chicago, Java ME: Mark:Chicago]

D. [Java ME: Jessy:Chicago, Java ME: Mark:Chicago] [Java EE: Helen:Houston]

Buy Now
Questions 12

Given:

public class Counter {

public static void main (String[ ] args) {

int a = 10;

int b = -1;

assert (b >=1) : "Invalid Denominator";

int = a / b;

System.out.println (c);

}

}

What is the result of running the code with the 璬a option?

A. -10

B. 0

C. An AssertionError is thrown.

D. A compilation error occurs.

Buy Now
Questions 13

Given the code fragment:

List empDetails = Arrays.asList("100, Robin, HR", "200, Mary, AdminServices","101, Peter, HR");

empDetails.stream()

.filter(s-> s.contains("r"))

.sorted()

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

What is the result?

A. 100, Robin, HR 101, Peter, HR

B. E. A compilation error occurs at line n1.

C. 101, Peter, HR 200, Mary, AdminServices

D. 100, Robin, HR 200, Mary, AdminServices 101, Peter, HR

Buy Now
Exam Code: 1Z0-809
Exam Name: Java SE 8 Programmer II
Last Update: May 05, 2024
Questions: 207
10%OFF Coupon Code: SAVE10

PDF (Q&A)

$45.99

VCE

$49.99

PDF + VCE

$59.99