1Z0-829練習試験テスト最新問題2024年05月
1Z0-829試験を一発合格保証問題集!
Oracle 1Z0-829 認定試験にパスすることは、Java 開発者にとってエキサイティングなキャリアの機会を開くことができます。認定取得者はトップ企業から高く求められ、より高い給与を得ることができます。また、認定はプロフェッショナルな成長と持続的な学習にコミットしていることを証明し、常に進化し続ける迅速な産業において開発者が常に最先端にあり続けるのに役立ちます。
Oracle 1Z0-829試験に合格するには、その機能、構文、概念を含むJava SE 17を完全に理解する必要があります。また、Javaを使用してエンタープライズアプリケーションの構築において実践的な経験を持つ必要があります。この試験は、150分以内に完了する必要がある75の複数選択の質問で構成されています。この試験に合格すると、Java SE 17を使用する習熟度が示され、仲間の間で熟練した開発者として際立っています。
Oracle 1Z0-829:Java SE 17 Developer試験は、Javaプログラミングの専門知識を持ちたいプロフェッショナルにとって優れた認定資格です。この試験は、オブジェクト指向プログラミング、並行処理、モジュール化プログラミングなどのトピックをカバーし、候補者のJava SE 17の知識とスキルを評価します。この認定は世界的に認められ、ソフトウェア開発業界の雇用主から高く評価されています。
質問 # 13
Given:
What is the result?
- A. Software Game Software Game chess 0
- B. Software Game Chess 2
- C. Software game write error
- D. Software Game Chess 0
- E. Software Game Software Game Chese 2
- F. Software Game read error
正解:E
解説:
The answer is B because the code uses the writeObject and readObject methods of the ObjectOutputStream and ObjectInputStream classes to serialize and deserialize the Game object. These methods use the default serialization mechanism, which writes and reads the state of the object's fields, including the inherited ones. Therefore, the title field of the Software class is also serialized and deserialized along with the players field of the Game class. The toString method of the Game class calls the toString method of the Software class using super.toString(), which returns the value of the title field. Hence, when the deserialized object is printed, it shows "Software Game Software Game Chess 2". Reference:
Oracle Certified Professional: Java SE 17 Developer
Java SE 17 Developer
OCP Oracle Certified Professional Java SE 17 Developer Study Guide
Serialization and Deserialization in Java with Example
質問 # 14
Given:
What is the result?
- A. 100
100
1000 - B. 101
101
1000 - C. 1001
100
1000 - D. 1001
1001
1000
正解:C
解説:
The code fragment is using the bitwise operators & (AND), | (OR), and ^ (XOR) to perform operations on the binary representations of the integer values. The & operator returns a 1 in each bit position where both operands have a 1, the | operator returns a 1 in each bit position where either operand has a 1, and the ^ operator returns a 1 in each bit position where only one operand has a 1. The binary representations of the integer values are as follows:
1000 = 1111101000
100 = 1100100
101 = 1100101
The code fragment performs the following operations:
x = x ^ y; // x becomes 1111010101, which is 1001 in decimal
y = x ^ y; // y becomes 1100100, which is 100 in decimal
x = x ^ y; // x becomes 1100101, which is 101 in decimal
The code fragment then prints out the values of x, y, and z, which are 1001, 100, and 1000 respectively. Therefore, option D is correct.
質問 # 15
Given:
What is the result?
- A. Compilation fails.
- B. 0
- C. Nothing is printed because of an indefinite loop.
- D. A runtime exception is thrown.
- E. 1
- F. 2
- G. 3
- H. 4
正解:A
解説:
The code will not compile because the variable 'x' is declared as final and then it is being modified in the switch statement. This is not allowed in Java. A final variable is a variable whose value cannot be changed once it is initialized1. The switch statement tries to assign different values to 'x' depending on the value of 'y', which violates the final modifier. The compiler will report an error: The final local variable x cannot be assigned. It must be blank and not using a compound assignment. Reference: The final Keyword (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
質問 # 16
Given the code fragment:
What is the result?
- A. PT5000PT60MP6D
- B. 5000$60M6D
- C. PT5SPTIMP6D
- D. $SIM6D
正解:A
解説:
Explanation
The code fragment is creating a Duration object with a value of 5000 milliseconds, then printing it. Then, it is creating another Duration object with a value of 60 seconds, then printing it. Finally, it is creating a Period object with a value of 6 days, then printing it. The output will be "PT5000PT60MP6D". References:
https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html,
https://docs.oracle.com/javase/8/docs/api/java/time/Period.html
質問 # 17
Given the code fragment:
Which code fragment invokes all callable objects in the workers set?
- A.

- B.

- C.

- D.

正解:B
解説:
Explanation
The code fragment in Option C invokes all callable objects in the workers set by using the ExecutorService's invokeAll() method. This method takes a collection of Callable objects and returns a list of Future objects representing the results of the tasks. The other options are incorrect because they either use the wrong method (invokeAny() or submit()) or have syntax errors (missing parentheses or semicolons). References: AbstractExecutorService (Java SE 17 & JDK 17) - Oracle
質問 # 18
Given the code fragment:
Which action enables the code to compile?
- A. Replace thye regNo variable static
- B. Remove the regNO initialization statement.
- C. Make the regNo variable static.
- D. Make the regNo variable public
- E. Replace record with void.
正解:D
解説:
The code will compile if the regNo variable is made public. This is because the regNo variable is being accessed in the main method of the App class, which is outside the scope of the Product class. Making the regNo variable public will allow it to be accessed from outside the class. Reference: https://education.oracle.com/products/trackp_OCPJSE17, https://mylearn.oracle.com/ou/learning-path/java-se-17-developer/99487, https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
質問 # 19
Given:
Which statement is true while the program prints GC?
- A. Both the objects previously referenced by t1 are eligible for garbage collection.
- B. None of the objects are eligible for garbage collection.
- C. Only the object referenced by t2 is eligible for garbage collection.
- D. Only one of the objects previously referenced by t1 is eligible for garbage collection.
正解:A
質問 # 20
Which statement is true about modules?
- A. Only automatic modules are on the module path.
- B. Automatic and unnamed modules are on the module path.
- C. Only unnamed modules are on the module path.
- D. Automatic and named modules are on the module path.
- E. Only named modules are on the module path.
正解:D
解説:
Explanation
A module path is a sequence of directories that contain modules or JAR files. A named module is a module that has a name and a module descriptor (module-info.class) that declares its dependencies and exports. An automatic module is a module that does not have a module descriptor, but is derived from the name and contents of a JAR file. Both named and automatic modules can be placed on the module path, and they can be resolved by the Java runtime. An unnamed module is a special module that contains all the classes that are not in any other module, such as those on the class path. An unnamed module is not on the module path, but it can read all other modules.
質問 # 21
Given the code fragment:
What is the result:
- A. ABCE
- B. ABCDE // the order of elements is unpredictable
- C. ADEABCB // the order of element is unpredictable
- D. ABBCDE // the order of elements is unpredictable
正解:D
解説:
The answer is D because the code fragment uses the Stream API to create two streams, s1 and s2, and then concatenates them using the concat() method. The resulting stream is then processed in parallel using the parallel() method, and the distinct() method is used to remove duplicate elements. Finally, the forEach() method is used to print the elements of the resulting stream to the console. Since the order of elements in a parallel stream is unpredictable, the output could be any of the options given, but option D is the most likely. Reference:
Oracle Certified Professional: Java SE 17 Developer
Java SE 17 Developer
OCP Oracle Certified Professional Java SE 17 Developer Study Guide
Parallelizing Streams
質問 # 22
Given:
Which two should the module-info file include for it to represent the service provider interface?
- A. Provides.com.transport.vehicle.cars.Car impl,CarImp1 to com.transport.vehicle.cars. Cars
- B. Requires cm.transport.vehicle,cars:
- C. Exports com.transport.vehicle;
- D. Provides.com.transport.vehicle.cars.Car with com.transport.vehicle.cars. impt, CatImpI;
- E. exports com.transport.vehicle.cars.Car;
- F. Requires cm.transport.vehicle,cars:
- G. Exports com.transport.vehicle.cars;
正解:D、E
解説:
The answer is B and E because the module-info file should include a provides directive and an exports directive to represent the service provider interface. The provides directive declares that the module provides an implementation of a service interface, which is com.transport.vehicle.cars.Car in this case. The with clause specifies the fully qualified name of the service provider class, which is com.transport.vehicle.cars.impl.CarImpl in this case. The exports directive declares that the module exports a package, which is com.transport.vehicle.cars in this case, to make it available to other modules. The package contains the service interface that other modules can use.
Option A is incorrect because requires is not the correct keyword to declare a service provider interface. Requires declares that the module depends on another module, which is not the case here.
Option C is incorrect because it has a typo in the module name. It should be com.transport.vehicle.cars, not cm.transport.vehicle.cars.
Option D is incorrect because it has a typo in the keyword provides. It should be provides, not Provides. It also has a typo in the service interface name. It should be com.transport.vehicle.cars.Car, not com.transport.vehicle.cars.Car impl. It also has an unnecessary to clause, which is used to limit the accessibility of an exported package to specific modules.
Option F is incorrect because it exports the wrong package. It should export com.transport.vehicle.cars, not com.transport.vehicle.cars.impl. The impl package contains the service provider class, which should not be exposed to other modules.
Option G is incorrect because it exports the wrong package. It should export com.transport.vehicle.cars, not com.transport.vehicle. The vehicle package does not contain the service interface or the service provider class. Reference:
Oracle Certified Professional: Java SE 17 Developer
Java SE 17 Developer
OCP Oracle Certified Professional Java SE 17 Developer Study Guide
Java Modules - Service Interface Module - GeeksforGeeks
Java Service Provider Interface | Baeldung
質問 # 23
Given:
Which two method invocation execute?
- A. IFace myclassobj = new Myc (); myclassObj.m3 ();
- B. IFace.m2();
- C. Ifnce.m3 ();
- D. new MyC() .m2 ();
- E. iFace mucloassObj = new Myc (); myClassObj.m4();
- F. IFace .,4():
正解:D、F
解説:
Explanation
The code given is an interface and a class that implements the interface. The interface has three methods, m1(), m2(), and m3(). The class has one method, m1(). The only two method invocations that will execute are D and E.
D is a call to the m2() method in the class, and E is a call to the m3() method in the interface. References:
https://education.oracle.com/products/trackp_OCPJSE17, 3, 4, 5
質問 # 24
Given:
Which action enables the code to compile?
- A. Replace 3 with private static void display () {
- B. Replace 15 with item.display (''Flower'');
- C. Replace 7 with public void display (string design) {
- D. Replace 2 with static string name;
正解:C
解説:
The answer is C because the code fragment contains a syntax error in line 7, where the method display is declared without any parameter type. This causes a compilation error, as Java requires the parameter type to be specified for each method parameter. To fix this error, the parameter type should be added before the parameter name, such as string design. This will enable the code to compile and run without any errors. Reference:
Oracle Certified Professional: Java SE 17 Developer
Java SE 17 Developer
OCP Oracle Certified Professional Java SE 17 Developer Study Guide
Java Methods
質問 # 25
Given:
What is the result?
- A. 0 CLOUDY
- B. 0 Snowy
- C. Compilation fails
- D. 1 Snowy
- E. 1 RAINY
正解:B
解説:
Explanation
The code is defining an enum class called Forecast with three values: SUNNY, CLOUDY, and RAINY. The toString() method is overridden to always return "SNOWY". In the main method, the ordinal value of SUNNY is printed, which is 0, followed by the value of CLOUDY converted to uppercase, which is "CLOUDY".
However, since the toString() method of Forecast returns "SNOWY" regardless of the actual value, the output will be "0 SNOWY". References: Enum (Java SE 17 & JDK 17), Enum.EnumDesc (Java SE 17 & JDK 17)
質問 # 26
Given the code fragment:
Which code fragment returns different values?
- A. int sum = listOfNumbers. parallelStream () reduce (5, Integer:: sum) ;
- B. int sum = listOfNumbers. Stream () reduce (5, (a, b) -> a + b) ;
- C. int sum = listOfNumbers. Stream () reduce (0, Integer:: sum) + 5
- D. int sum = listOfNumbers. parallelStream () reduce ({m, n) -> m +n) orElse (5) +5;
- E. int sum = listOfNumbers. Stream () reduce ( Integer:: sum) ; +5;
正解:E
解説:
The answer is C because the code fragment uses a different syntax and logic for the reduce operation than the other options. The reduce method in option C takes a single parameter, which is a BinaryOperator that combines two elements of the stream into one. The method returns an Optional, which may or may not contain a value depending on whether the stream is empty or not. The code fragment then adds 5 to the result of the reduce method, regardless of whether it is present or not. This may cause an exception if the Optional is empty, or produce a different value than the other options if the Optional is not empty.
The other options use a different syntax and logic for the reduce operation. They all take two parameters, which are an identity value and a BinaryOperator that combines an element of the stream with an accumulator. The method returns the final accumulator value, which is equal to the identity value if the stream is empty, or the result of applying the BinaryOperator to all elements of the stream otherwise. The code fragments then add 5 to the result of the reduce method, which will always produce a valid value.
For example, suppose listOfNumbers contains [1, 2, 3]. Then, option A will perform the following steps:
Initialize accumulator to identity value 5
Apply BinaryOperator Integer::sum to accumulator and first element: 5 + 1 = 6 Update accumulator to 6 Apply BinaryOperator Integer::sum to accumulator and second element: 6 + 2 = 8 Update accumulator to 8 Apply BinaryOperator Integer::sum to accumulator and third element: 8 + 3 = 11 Update accumulator to 11 Return final accumulator value 11 Add 5 to final accumulator value: 11 + 5 = 16 Option B will perform the same steps as option A, except using a lambda expression instead of a method reference for the BinaryOperator. Option D will perform the same steps as option A, except using parallelStream instead of stream, which may change the order of applying the BinaryOperator but not the final result. Option E will perform the same steps as option A, except using identity value 0 instead of 5.
Option C, however, will perform the following steps:
Apply BinaryOperator Integer::sum to first and second element: 1 + 2 = 3 Apply BinaryOperator Integer::sum to previous result and third element: 3 + 3 = 6 Return Optional containing final result value 6 Add 5 to Optional value: Optional.of(6) + 5 = Optional.of(11) As you can see, option C produces a different value than the other options, and also uses a different syntax and logic for the reduce operation. Reference:
Oracle Certified Professional: Java SE 17 Developer
Java SE 17 Developer
OCP Oracle Certified Professional Java SE 17 Developer Study Guide
Guide to Stream.reduce()
質問 # 27
Given:
and the code fragment:
- A. 300.00 CellPhone.ToyCar
- B. 100.00
CellPhone,ToyCar,Motor,Fan - C. 300.00
CellPhone,ToyCar,Motor,Fan - D. 100.00 CellPhone,ToyCar
正解:C
解説:
Explanation
The code fragment is using the Stream API to perform a reduction operation on a list of ElectricProduct objects. The reduction operation consists of three parts: an identity value, an accumulator function, and a combiner function. The identity value is the initial value of the result, which is 0.0 in this case. The accumulator function is a BiFunction that takes two arguments: the current result and the current element of the stream, and returns a new result. In this case, the accumulator function is (a,b) -> a + b.getPrice (), which means that it adds the price of each element to the current result. The combiner function is a BinaryOperator that takes two partial results and combines them into one. In this case, the combiner function is (a,b) -> a + b, which means that it adds the two partial results together.
The code fragment then applies a filter operation on the stream, which returns a new stream that contains only the elements that match the given predicate. The predicate is p -> p.getPrice () > 10, which means that it selects only the elements that have a price greater than 10. The code fragment then applies a map operation on the filtered stream, which returns a new stream that contains the results of applying the given function to each element. The function is p -> p.getName (), which means that it returns the name of each element.
The code fragment then calls the collect method on the mapped stream, which performs a mutable reduction operation on the elements of the stream using a Collector. The Collector is Collectors.joining (","), which means that it concatenates the elements of the stream into a single String, separated by commas.
The code fragment then prints out the result of the reduction operation and the result of the collect operation, separated by a new line. The result of the reduction operation is 300.00, which is the sum of the prices of all ElectricProduct objects that have a price greater than 10. The result of the collect operation is CellPhone,ToyCar,Motor,Fan, which is the concatenation of the names of all ElectricProduct objects that have a price greater than 10.
Therefore, the output of the code fragment is:
300.00 CellPhone,ToyCar,Motor,Fan
References: Stream (Java SE 17 & JDK 17) - Oracle, Collectors (Java SE 17 & JDK 17) - Oracle
質問 # 28
Given the code fragment:
What is the result?
- A. Range1
Note a valid rank. - B. Range 1
- C. Range 1
Range 2
Range 3 - D. Range 1
Range 2
Range 3
Range 1
Not a valida rank
正解:D
解説:
Explanation
The code fragment is using the switch statement with the new Java 17 syntax. The switch statement checks the value of the variable rank and executes the corresponding case statement. In this case, the value of rank is 4, so the first case statement is executed, printing "Range1". The second and third case statements are also executed, printing "Range2" and "Range3". The default case statement is also executed, printing "Not a valid rank". References: Java Language Changes - Oracle Help Center
質問 # 29
Given the directory structure:
Given the definition of the Doc class:
Which two are valid definition of the wordDoc class?
- A. Package p1, p2;
Public sealed class WordDoc extends Doc () - B. Package p1, p2;
Public non-sealed class WordDoc extends Doc () - C. Package p1;
Public final class WordDoc extends Doc () - D. Package p1;
Public non-sealed class wordDoc extends Doc () - E. Package p1,
non-sealed abstract class WordDoc extends Doc () - F. Package p1;
Public class wordDoc extends Doc ()
正解:C、D
解説:
Explanation
The correct answer is A and F because the wordDoc class must be a non-sealed class or a final class to extend the sealed Doc class. Option B is incorrect because the wordDoc class must be non-sealed or final. Option C is incorrect because the wordDoc class cannot be in a different package than the Doc class. Option D is incorrect because the wordDoc class cannot be a sealed class. Option E is incorrect because the wordDoc class cannot be an abstract class. References: Oracle Certified Professional: Java SE 17 Developer, 3 Sealed Classes - Oracle Help Center
質問 # 30
......
Oracle Java無料認定試験材料はGoShikenが提供された50問題:https://www.goshiken.com/Oracle/1Z0-829-mondaishu.html
1Z0-829問題集完全版問題試験学習ガイド:https://drive.google.com/open?id=10Mll2NIsyf07-hDx4u4Y-WgBQCrid_Sp