Sign In
Home/Oracle/1z0-829/Free questions

1z0-829 — Free Practice Questions

10 free sample questions from a bank of 66, with the correct answers and explanations. No signup required — start practising right now.

1Given the code fragment: and Which is true?
1z0-829 question 11z0-829 question 1
  • The program prints t1 : 1 : t2 : 1: t1 : 2 : t2 : 2 : in random order.
  • The program prints t1 : 1 : t2 : 1: t1 : 2 : t2 : 2 :
  • The program prints t1 : 1 : t2 : 1: t1 : 1 : t2 : 1 : indefinitely.
  • The program prints an exception.
Answer: A
2Given: What is the result?
1z0-829 question 2
  • Compilation fails.
  • there
  • hello
  • A NumberFormatException is thrown.
Answer: C
3Given the code fragment: Which set of class definitions compiles?
1z0-829 question 3
  • interface Story extends SInt {} interface Art extends SInt {}
  • public interface Story extends SInt {} public interface Art extends SInt {}
  • sealed interface Story extends SInt {} non-sealed class Art implements SInt {}
  • non-sealed interface Story extends SInt {} non-sealed interface Art extends SInt {}
  • non-sealed interface Story extends SInt {} class Art implements SInt {}
Answer: D
4Given the code fragment: What is the result?
1z0-829 question 4
  • ABBCDE // the order of elements is unpredictable
  • ABCDE
  • ABCDE // the order of elements is unpredictable
  • ADEABCB // the order of elements is unpredictable
Answer: C
5Which statement is true about modules?
  • Only unnamed modules are on the module path.
  • Automatic and named modules are on the module path.
  • Only automatic modules are on the module path.
  • Only named modules are on the module path.
  • Automatic and unnamed modules are on the module path.
Answer: B
6Given the code fragment: Which code at line n1, obtains the java.io.Console object?
1z0-829 question 6
  • Console console = Console.getInstance();
  • Console console = System.console();
  • Console console = new Console(System.in);
  • Console console = new Console(new InputStreamReader(System.in));
  • Console console = System.console(System.in);
Answer: B
7Given the content of the in.txt file: 0123456789 and the code fragment: What is the content of the out.txt file?
1z0-829 question 7
  • 012345678
  • 01234567801234
  • 01234567
  • 0123456789
  • 012345678901234
  • 0123456789234567
Answer: F
8Which statement is true?
  • IllegalStateException is thrown if a thread in waiting state is moved back to runnable.
  • A thread in waiting state consumes CPU cycles.
  • After the timed wait expires, the waited thread moves to the terminated state.
  • A thread in waiting state must handle InterruptedException.
Answer: D
9Given the code fragment: List listOfNumbers = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); Which code fragment returns different values?
  • int sum = listOfNumbers.stream().reduce(0, Integer::sum) + 5;
  • int sum = listOfNumbers.parallelStream().reduce(0, Integer::sum) + 5 ;
  • int sum = listOfNumbers.parallelStream().reduce((m, n) -> m + n).orElse(5) + 5;
  • int sum = listOfNumbers.parallelStream().reduce(5, Integer::sum);
  • int sum = listOfNumbers.stream().reduce(5, (a, b) -> a+ b);
Answer: D
10Given the code fragment: Which two statements at Line n1 independently enable you to print 1250? (Choose two.)
1z0-829 question 10
  • Integer res = 250 + Integer.parseInt(s);
  • Integer res = 250 + Integer.valueOf(s);
  • Integer res = 250 + s2;
  • Integer res = 250; res =+ s2;
  • Integer res = 250 + s;
  • Integer res = 250 + Integer(s2);
Answer:

Want the full bank of 66 questions for 1z0-829? See all practice exams.