Month End Sale - Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 65percent

Welcome To DumpsPedia

1z0-830 Sample Questions Answers

Questions 4

Which two of the following aren't the correct ways to create a Stream?

Options:

A.

Stream stream = Stream.of("a");

B.

Stream stream = Stream.ofNullable("a");

C.

Stream stream = Stream.generate(() -> "a");

D.

Stream stream = Stream.of();

E.

Stream stream = new Stream();

F.

Stream stream = Stream.builder().add("a").build();

G.

Stream stream = Stream.empty();

Buy Now
Questions 5

Given:

var cabarets = new TreeMap<>();

cabarets.put(1, "Moulin Rouge");

cabarets.put(2, "Crazy Horse");

cabarets.put(3, "Paradis Latin");

cabarets.put(4, "Le Lido");

cabarets.put(5, "Folies Bergère");

System.out.println(cabarets.subMap(2, true, 5, false));

What is printed?

Options:

A.

CopyEdit

{2=Crazy Horse, 3=Paradis Latin, 4=Le Lido, 5=Folies Bergère}

B.

{2=Crazy Horse, 3=Paradis Latin, 4=Le Lido}

C.

{}

D.

An exception is thrown at runtime.

E.

Compilation fails.

Buy Now
Questions 6

Given:

java

Object input = 42;

String result = switch (input) {

case String s -> "It's a string with value: " + s;

case Double d -> "It's a double with value: " + d;

case Integer i -> "It's an integer with value: " + i;

};

System.out.println(result);

What is printed?

Options:

A.

null

B.

It's a string with value: 42

C.

It's a double with value: 42

D.

It's an integer with value: 42

E.

It throws an exception at runtime.

F.

Compilation fails.

Buy Now
Questions 7

Given:

java

LocalDate localDate = LocalDate.of(2020, 8, 8);

Date date = java.sql.Date.valueOf(localDate);

DateFormat formatter = new SimpleDateFormat(/* pattern */);

String output = formatter.format(date);

System.out.println(output);

It's known that the given code prints out "August 08".

Which of the following should be inserted as the pattern?

Options:

A.

MM d

B.

MM dd

C.

MMMM dd

D.

MMM dd

Buy Now
Questions 8

How would you create a ConcurrentHashMap configured to allow a maximum of 10 concurrent writer threads and an initial capacity of 42?

Which of the following options meets this requirement?

Options:

A.

var concurrentHashMap = new ConcurrentHashMap(42);

B.

None of the suggestions.

C.

var concurrentHashMap = new ConcurrentHashMap();

D.

var concurrentHashMap = new ConcurrentHashMap(42, 10);

E.

var concurrentHashMap = new ConcurrentHashMap(42, 0.88f, 10);

Buy Now
Questions 9

Given:

java

public class Test {

public static void main(String[] args) throws IOException {

Path p1 = Path.of("f1.txt");

Path p2 = Path.of("f2.txt");

Files.move(p1, p2);

Files.delete(p1);

}

}

In which case does the given program throw an exception?

Options:

A.

Neither files f1.txt nor f2.txt exist

B.

Both files f1.txt and f2.txt exist

C.

An exception is always thrown

D.

File f2.txt exists while file f1.txt doesn't

E.

File f1.txt exists while file f2.txt doesn't

Buy Now
Questions 10

Given:

java

List abc = List.of("a", "b", "c");

abc.stream()

.forEach(x -> {

x = x.toUpperCase();

});

abc.stream()

.forEach(System.out::print);

What is the output?

Options:

A.

abc

B.

An exception is thrown.

C.

Compilation fails.

D.

ABC

Buy Now
Questions 11

Given:

java

var ceo = new HashMap<>();

ceo.put("Sundar Pichai", "Google");

ceo.put("Tim Cook", "Apple");

ceo.put("Mark Zuckerberg", "Meta");

ceo.put("Andy Jassy", "Amazon");

Does the code compile?

Options:

A.

True

B.

False

Buy Now
Questions 12

Which StringBuilder variable fails to compile?

java

public class StringBuilderInstantiations {

public static void main(String[] args) {

var stringBuilder1 = new StringBuilder();

var stringBuilder2 = new StringBuilder(10);

var stringBuilder3 = new StringBuilder("Java");

var stringBuilder4 = new StringBuilder(new char[]{'J', 'a', 'v', 'a'});

}

}

Options:

A.

None of them

B.

stringBuilder4

C.

stringBuilder1

D.

stringBuilder3

E.

stringBuilder2

Buy Now
Questions 13

Given:

java

final Stream strings =

Files.readAllLines(Paths.get("orders.csv"));

strings.skip(1)

.limit(2)

.forEach(System.out::println);

And that the orders.csv file contains:

mathematica

OrderID,Customer,Product,Quantity,Price

1,Kylian Mbappé,Keyboard,2,25.50

2,Teddy Riner,Mouse,1,15.99

3,Sebastien Loeb,Monitor,1,199.99

4,Antoine Griezmann,Headset,3,45.00

What is printed?

Options:

A.

arduino

1,Kylian Mbappé,Keyboard,2,25.50

2,Teddy Riner,Mouse,1,15.99

3,Sebastien Loeb,Monitor,1,199.99

4,Antoine Griezmann,Headset,3,45.00

B.

arduino

1,Kylian Mbappé,Keyboard,2,25.50

2,Teddy Riner,Mouse,1,15.99

C.

arduino

2,Teddy Riner,Mouse,1,15.99

3,Sebastien Loeb,Monitor,1,199.99

D.

An exception is thrown at runtime.

E.

Compilation fails.

Buy Now
Questions 14

Given:

java

Object myVar = 0;

String print = switch (myVar) {

case int i -> "integer";

case long l -> "long";

case String s -> "string";

default -> "";

};

System.out.println(print);

What is printed?

Options:

A.

integer

B.

long

C.

string

D.

nothing

E.

It throws an exception at runtime.

F.

Compilation fails.

Buy Now
Questions 15

Consider the following methods to load an implementation of MyService using ServiceLoader. Which of the methods are correct? (Choose all that apply)

Options:

A.

MyService service = ServiceLoader.load(MyService.class).iterator().next();

B.

MyService service = ServiceLoader.load(MyService.class).findFirst().get();

C.

MyService service = ServiceLoader.getService(MyService.class);

D.

MyService service = ServiceLoader.services(MyService.class).getFirstInstance();

Buy Now
Questions 16

Given:

java

public class ExceptionPropagation {

public static void main(String[] args) {

try {

thrower();

System.out.print("Dom Pérignon, ");

} catch (Exception e) {

System.out.print("Chablis, ");

} finally {

System.out.print("Saint-Émilion");

}

}

static int thrower() {

try {

int i = 0;

return i / i;

} catch (NumberFormatException e) {

System.out.print("Rosé");

return -1;

} finally {

System.out.print("Beaujolais Nouveau, ");

}

}

}

What is printed?

Options:

A.

Saint-Émilion

B.

Beaujolais Nouveau, Chablis, Saint-Émilion

C.

Beaujolais Nouveau, Chablis, Dom Pérignon, Saint-Émilion

D.

Rosé

Buy Now
Questions 17

Given:

java

StringBuffer us = new StringBuffer("US");

StringBuffer uk = new StringBuffer("UK");

Stream stream = Stream.of(us, uk);

String output = stream.collect(Collectors.joining("-", "=", ""));

System.out.println(output);

What is the given code fragment's output?

Options:

A.

US-UK

B.

An exception is thrown.

C.

-US=UK

D.

=US-UK

E.

Compilation fails.

F.

US=UK

Buy Now
Questions 18

Which of the following statements is correct about a final class?

Options:

A.

The final keyword in its declaration must go right before the class keyword.

B.

It must contain at least a final method.

C.

It cannot be extended by any other class.

D.

It cannot implement any interface.

E.

It cannot extend another class.

Buy Now
Questions 19

Given:

java

var deque = new ArrayDeque<>();

deque.add(1);

deque.add(2);

deque.add(3);

deque.add(4);

deque.add(5);

System.out.print(deque.peek() + " ");

System.out.print(deque.poll() + " ");

System.out.print(deque.pop() + " ");

System.out.print(deque.element() + " ");

What is printed?

Options:

A.

1 1 1 1

B.

1 5 5 1

C.

1 1 2 3

D.

1 1 2 2

E.

5 5 2 3

Buy Now
Questions 20

Which of the following statements are correct?

Options:

A.

You can use 'private' access modifier with all kinds of classes

B.

You can use 'protected' access modifier with all kinds of classes

C.

You can use 'public' access modifier with all kinds of classes

D.

You can use 'final' modifier with all kinds of classes

E.

None

Buy Now
Questions 21

Given:

java

var counter = 0;

do {

System.out.print(counter + " ");

} while (++counter < 3);

What is printed?

Options:

A.

0 1 2 3

B.

0 1 2

C.

1 2 3 4

D.

1 2 3

E.

An exception is thrown.

F.

Compilation fails.

Buy Now
Questions 22

Given:

java

Integer frenchRevolution = 1789;

Object o1 = new String("1789");

Object o2 = frenchRevolution;

frenchRevolution = null;

Object o3 = o2.toString();

System.out.println(o1.equals(o3));

What is printed?

Options:

A.

true

B.

false

C.

A NullPointerException is thrown.

D.

A ClassCastException is thrown.

E.

Compilation fails.

Buy Now
Questions 23

Given:

java

String s = " ";

System.out.print("[" + s.strip());

s = " hello ";

System.out.print("," + s.strip());

s = "h i ";

System.out.print("," + s.strip() + "]");

What is printed?

Options:

A.

[ ,hello,h i]

B.

[,hello,h i]

C.

[,hello,hi]

D.

[ , hello ,hi ]

Buy Now
Questions 24

Which of the following methods of java.util.function.Predicate aredefault methods?

Options:

A.

and(Predicate<? super T> other)

B.

isEqual(Object targetRef)

C.

negate()

D.

not(Predicate<? super T> target)

E.

or(Predicate<? super T> other)

F.

test(T t)

Buy Now
Questions 25

Which methods compile?

Options:

A.

```java public List getListSuper() { return new ArrayList(); }

csharp

B.

```java

public List getListExtends() {

return new ArrayList();

}

C.

```java public List getListExtends() { return new ArrayList(); }

csharp

D.

```java

public List getListSuper() {

return new ArrayList();

}

Buy Now
Exam Code: 1z0-830
Exam Name: Java SE 21 Developer Professional
Last Update: Apr 28, 2025
Questions: 84
$57.75  $164.99
$43.75  $124.99
$36.75  $104.99
buy now 1z0-830