1Z0 825 JPN Java SE 17 Programmer I Practice Exam, Exams of Technology

This practice exam assesses foundational Java SE 17 skills, including classes, objects, inheritance, interfaces, exception handling, APIs, modular development, and language enhancements such as records and sealed classes. Tailored for Japanese-language learners, it reinforces understanding of coding best practices, application structure, data manipulation, and JVM fundamentals.

Typology: Exams

2025/2026

Available from 01/08/2026

shilpi-jain-1
shilpi-jain-1 🇮🇳

4.2

(5)

29K documents

1 / 93

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1Z0 825 JPN Java SE 17 Programmer I Practice Exam
**Question 1.** Which component of the Java platform provides platform independence?
A) Java Development Kit (JDK)
B) Java Virtual Machine (JVM)
C) Java Runtime Environment (JRE)
D) Java API
Answer: B
Explanation: The JVM abstracts the underlying hardware and OS, allowing Java bytecode to run
unchanged on any platform.
**Question 2.** In the compilation process, which file is generated after running `javac` on a `.java`
source file?
A) .class file
B) .jar file
C) .exe file
D) .txt file
Answer: A
Explanation: `javac` compiles source code into bytecode stored in a `.class` file.
**Question 3.** Which statement correctly defines the entry point of a Java application?
A) `public static void start(String[] args)`
B) `public void main()`
C) `public static void main(String[] args)`
D) `static void main()`
Answer: C
Explanation: The JVM looks for `public static void main(String[] args)` to start execution.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d

Partial preview of the text

Download 1Z0 825 JPN Java SE 17 Programmer I Practice Exam and more Exams Technology in PDF only on Docsity!

Question 1. Which component of the Java platform provides platform independence? A) Java Development Kit (JDK) B) Java Virtual Machine (JVM) C) Java Runtime Environment (JRE) D) Java API Answer: B Explanation: The JVM abstracts the underlying hardware and OS, allowing Java bytecode to run unchanged on any platform. Question 2. In the compilation process, which file is generated after running javac on a .java source file? A) .class file B) .jar file C) .exe file D) .txt file Answer: A Explanation: javac compiles source code into bytecode stored in a .class file. Question 3. Which statement correctly defines the entry point of a Java application? A) public static void start(String[] args) B) public void main() C) public static void main(String[] args) D) static void main() Answer: C Explanation: The JVM looks for public static void main(String[] args) to start execution.

Question 4. How do you run a compiled Java class named HelloWorld from the command line? A) java HelloWorld.java B) java HelloWorld C) javac HelloWorld D) run HelloWorld Answer: B Explanation: java executes the bytecode in HelloWorld.class. Question 5. What is the purpose of a package declaration in a Java source file? A) To import external libraries automatically B) To define the class’s access level C) To group related classes and avoid name conflicts D) To compile the class faster Answer: C Explanation: Packages organize classes into namespaces, preventing naming collisions. Question 6. Which syntax correctly imports the ArrayList class? A) import java.util.*; B) import java.util.ArrayList; C) using java.util.ArrayList; D) include java.util.ArrayList; Answer: B Explanation: import java.util.ArrayList; imports that specific class. Question 7. Which primitive type can store the value true?

B) Integer C) Float D) Double Answer: A Explanation: The Long class wraps a long value. Question 11. Which method of the Math class returns the larger of two numbers? A) Math.max(a, b) B) Math.greater(a, b) C) Math.highest(a, b) D) Math.big(a, b) Answer: A Explanation: Math.max returns the greater argument. Question 12. What is the effect of using var in a local variable declaration? A) The variable becomes a global variable B) The compiler infers the variable’s type from the initializer C) The variable is implicitly final D) The variable can change its type at runtime Answer: B Explanation: var enables local type inference based on the right‑hand side expression. Question 13. Which of the following creates a mutable sequence of characters? A) String s = "abc"; B) StringBuilder sb = new StringBuilder("abc");

C) StringBuffer sb = new StringBuffer("abc"); D) Both B and C Answer: D Explanation: Both StringBuilder and StringBuffer provide mutable character sequences. Question 14. How do you define a text block containing multiple lines of text? A) String txt = """Line1\nLine2"""; B) String txt = """Line Line2"""; C) String txt = "Line1\nLine2"; D) String txt = '''Line Line2'''; Answer: B Explanation: Java 15+ text blocks use triple double quotes spanning multiple lines. Question 15. Which operator has higher precedence? A) && B) || C) + D) * Answer: D Explanation: Multiplication (*) is evaluated before addition (+) and logical operators. Question 16. What is the result of the expression "Hello" + 5 + 3? A) "Hello53"

B) case 1 : "One" C) case 1 => "One" D) case 1 => { "One" } Answer: A Explanation: Java 14+ switch expressions use -> for case arms. Question 20. Which loop guarantees that its body executes at least once? A) for loop B) while loop C) do/while loop D) Enhanced for loop Answer: C Explanation: The do block runs before the condition is checked. Question 21. Which statement correctly exits the nearest enclosing loop? A) return; B) break; C) continue; D) exit; Answer: B Explanation: break terminates the current loop (or switch). Question 22. What is the effect of the continue statement inside a for loop? A) Ends the loop completely B) Skips the remainder of the current iteration and proceeds to the next iteration

C) Restarts the loop from the beginning D) Throws a compile‑time error Answer: B Explanation: continue jumps to the loop’s update step (or condition check). Question 23. Which keyword is used to declare a class that cannot be subclassed? A) static B) final C) abstract D) sealed Answer: B Explanation: final classes cannot be extended. Question 24. Which of the following statements about constructors is FALSE? A) A constructor has no return type, not even void B) A default constructor is provided only if no other constructors are declared C) Constructors can be static D) Constructors can be overloaded with different parameter lists Answer: C Explanation: Constructors cannot be static; they are invoked on object creation. Question 25. Which access modifier provides visibility only within the same package and subclasses? A) public B) protected

C) super D) current Answer: A Explanation: this refers to the current instance. Question 29. Which statement correctly calls a superclass constructor with arguments? A) super(arg1, arg2); B) this(arg1, arg2); C) base(arg1, arg2); D) parent(arg1, arg2); Answer: A Explanation: super(...) invokes a constructor of the immediate superclass. Question 30. What is the result of assigning a subclass object to a superclass reference? A) Compile‑time error B) The reference can only call methods declared in the superclass C) The object’s type changes to the superclass type D) The object is duplicated as a superclass instance Answer: B Explanation: The reference type determines accessible members; runtime dispatch still uses the subclass implementation. Question 31. Which cast is necessary to invoke a subclass‑specific method on a superclass reference? A) No cast is needed B) (SubClass) superRef

C) (SuperClass) subRef D) ((SuperClass) subRef).subMethod() Answer: B Explanation: Downcasting the superclass reference to the subclass type enables access to subclass‑specific members. Question 32. Which statement about abstract classes is TRUE? A) They can be instantiated directly B) They may contain abstract and concrete methods C) All methods must be abstract D) They cannot have constructors Answer: B Explanation: Abstract classes can mix abstract and concrete methods and can define constructors. Question 33. Which keyword allows an interface to provide a default implementation for a method? A) static B) default C) abstract D) final Answer: B Explanation: default methods in interfaces have a body and can be inherited. Question 34. Which of the following is a functional interface? A) java.util.List B) java.lang.Runnable

C) try (BufferedReader br = ...) {} D) finally {} Answer: C Explanation: The try‑with‑resources statement closes any AutoCloseable resource when the block ends. Question 38. Which syntax allows catching multiple exception types in a single catch clause? A) catch (IOException | SQLException ex) {} B) catch (IOException, SQLException ex) {} C) catch (Exception ex) {} D) catch (IOException ex) | (SQLException ex) {} Answer: A Explanation: The multi‑catch feature uses the | operator between exception types. Question 39. How do you define a custom checked exception named DataNotFoundException? A) class DataNotFoundException extends RuntimeException {} B) class DataNotFoundException extends Exception {} C) class DataNotFoundException implements Exception {} D) class DataNotFoundException extends Throwable {} Answer: B Explanation: Extending Exception creates a checked exception. Question 40. Which statement throws a custom exception with a message? A) throw new MyException("Error"); B) raise new MyException("Error");

C) throw MyException("Error"); D) exception MyException("Error"); Answer: A Explanation: throw new MyException("Error"); creates and throws the exception object. Question 41. Which declaration creates a one‑dimensional array of 10 integers? A) int[] arr = new int[10]; B) int arr = new int[10]; C) int[10] arr = new int[]; D) int[] arr = {10}; Answer: A Explanation: new int[10] allocates an array of length 10. Question 42. How do you access the element at index 3 of an array named values? A) values(3) B) values[3] C) values{3} D) values->3 Answer: B Explanation: Array access uses square brackets. Question 43. Which statement correctly creates a two‑dimensional array of double with 5 rows and 4 columns? A) double[][] matrix = new double[5][4]; B) double[5][4] matrix = new double[][];

C) search(key) D) lookup(key) Answer: A Explanation: Map#get retrieves the value for the specified key. Question 47. Which statement sorts a List<Integer> named numbers in natural order? A) Collections.sort(numbers); B) numbers.sort(); C) numbers.order(); D) Arrays.sort(numbers); Answer: A Explanation: Collections.sort sorts a List using natural ordering. Question 48. Which class represents an immutable date without time-of‑day? A) java.util.Date B) java.time.LocalDate C) java.time.LocalDateTime D) java.time.Instant Answer: B Explanation: LocalDate stores only year, month, and day. Question 49. How do you obtain the current time as a LocalTime instance? A) LocalTime.now(); B) new LocalTime(); C) LocalTime.current();

D) LocalTime.get(); Answer: A Explanation: The static now() method returns the current time. Question 50. Which formatter pattern produces a date like 2023- 04 - 15? A) "dd/MM/yyyy" B) "yyyy-MM-dd" C) "MM-dd-yyyy" D) "yyyy/dd/MM" Answer: B Explanation: DateTimeFormatter.ofPattern("yyyy-MM-dd") matches that format. Question 51. Which statement creates a Duration representing 90 seconds? A) Duration.ofSeconds(90); B) Duration.ofMinutes(1,30); C) Duration.of(90, ChronoUnit.SECONDS); D) Both A and C Answer: D Explanation: Both ofSeconds(90) and of(90, ChronoUnit.SECONDS) create the same duration. Question 52. Which method converts a LocalDateTime to a ZonedDateTime in the system default zone? A) atZone(ZoneId.systemDefault()) B) toZonedDateTime() C) withZoneSameInstant(ZoneId.systemDefault())

Answer: A Explanation: @Override signals intent to override and triggers compile‑time checking. Question 56. What is the output of the following code?

int i = 5; System.out.println(i++ + ++i); 

A) 11 B) 12 C) 13 D) 10 Answer: B Explanation: i++ yields 5 (i becomes 6), then ++i makes i 7; 5 + 7 = 12. Question 57. Which collection guarantees iteration order equal to insertion order? A) HashSet B) TreeSet C) LinkedHashSet D) PriorityQueue Answer: C Explanation: LinkedHashSet maintains a linked list of entries preserving insertion order. Question 58. Which method of StringBuilder appends a character sequence and returns the same builder?

A) append() B) add() C) concat() D) insert() Answer: A Explanation: append adds content and returns the builder for chaining. Question 59. Which statement correctly creates a lambda expression that implements Comparator<String> to sort by length? A) (s1, s2) - > s1.length() - s2.length() B) (s1, s2) - > Integer.compare(s1.length(), s2.length()) C) (s1, s2) - > s1.compareTo(s2) D) Both A and B Answer: D Explanation: Both expressions provide a valid comparator based on length. Question 60. Which keyword is used to prevent a method from being overridden in a subclass? A) static B) final C) abstract D) sealed Answer: B Explanation: Declaring a method final stops overriding. Question 61. Which statement correctly creates a Predicate<Integer> that tests for even numbers?