New Semester
Started
Get
50% OFF
Study Help!
--h --m --s
Claim Now
Question Answers
Textbooks
Find textbooks, questions and answers
Oops, something went wrong!
Change your search query and then try again
S
Books
FREE
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Tutors
Online Tutors
Find a Tutor
Hire a Tutor
Become a Tutor
AI Tutor
AI Study Planner
NEW
Sell Books
Search
Search
Sign In
Register
study help
computer science
oracle
OCP Oracle Certified Professional Java SE 11 Developer Practice Tests Exam 1Z0 819 And Upgrade Exam 1Z0 817 1st Edition Scott Selikoff, Jeanne Boyarsky - Solutions
Suppose you have the following interface in a module named animal.insect.api. What needs to be included in the module-info file for it to be a service provider interface? A. exports animal.insect.api;B. exports animal.insect.api.bugs;C. exports animal.insect.api.bugs.Bug;D. requires
What command is the simplest way to list what modules a JAR depends on including package names? A. jdeps cookie.jarB. jdeps –s cookie.jarC. jdeps –jdkinternals cookie.jarD. jdeps --jdkinternals cookie.jarE. jdeps -jdk-unsupported cookie.jarF. jdeps --jdk-unsupported cookie.jar.
How many modules are part of the cyclic dependency? A. 0B. 1C. 2D. 3E. 4 module com.light { exports com.light; } module com.animal { exports com.animal; requires com.light; requires com.plant; } module com.plant { exports com.plant; requires com.light; requires com.animal; } module com.worm {
What is true about the -d option?A. It can be used with the jar command, but not the java command.B. It can be used with the java command, but not the jar command.C. It can be used with the jar and java commands and serves the same purpose for both.D. It can be used with the jar and java
Assuming all referenced files and directories exist and are correct, what does this code do? A. Creates a JAR file representing the com.mouse moduleB. Creates a JAR file that is not a moduleC. Fails on the javac commandD. Fails on the jar command. javac -m mods -d mouse mouse/com/mouse/*.java
What module is always in the jdeps output?A. java.baseB. java.langC. java.selfD. jdk.baseE. jdk.langF. jdk.self
Which are valid modes on the jmod command? (Choose three.)A. createB. listC. hashD. showE. verboseF. version
This diagram shows the second step of a migration to modules. What type of migration is this? A. Bottom-up.B. Side-to-side.C. Top-down.D. There is not enough information to determine which type it is. classpath butterfly module path caterpillar
Suppose we have the two JARs in the diagram on the module path and the module-info in the com.magic jar only exports one package: com.magic.unicorn. There is no module-info file in the com.science JAR. How many of the four packages in the diagram can a third module on the module path
Suppose the two JARs described in the previous question are on the classpath. How many of the four packages in the diagram can a module on the module path access?A. 0B. 1C. 2D. 3E. 4
What is true about the following module-info.java file?module Book { }.A. It does not compile because it is empty.B. It does not compile because the module name is uppercase.C. It does not compile because the module name has only one component.D. It does not compile for another reason.E. It
When adding a new service provider, which of these do you need to recompile?A. ConsumerB. Service locatorC. Existing service providersD. Service provider interfaceE. None of the above.
When working with modules, what option names are equivalent to -m and -s?A. --module and --shortB. --module and --statisticsC. --module and --summaryD. --module-path and --shortE. --module-path and --statisticsF. --module-path and --summary.
Which are considered part of a service?A. Classes referenced by the implementation, but not the interfaceB. Classes referenced by the interface, but not the implementationC. Classes referenced by either the implementation or the interfaceD. None of the above.
Which commands have the options -m and –s to represent modules and summary, respectively?A. javac and jarB. javac and jdepsC. javac and jmodD. java and jarE. java and jdepsF. java and jmod.
Suppose you have the following class in a module named animal.insect.impl. Which two most likely go in the module-info of the service locator? (Choose two.) A. requires animal.insect.api.bugs;B. requires animal.insect.api.bugs.Bug;C. requires animal.insect.impl;D. uses
Which statements are true? (Choose two.)A. A bottom-up migration has more steps involving the classpath than a top-down migration.B. A top-down migration has more steps involving the classpath than a bottom-up migration.C. Both types of migration have the same number of steps involving the
Fill in the blank with code to look up and call a service. A. Mouse.get()B. Mouse::getC. Provider.get()D. Provider::getE. None of the above. String cheese ServiceLoader.load(Mouse.class) .stream() .map (. .map (Mouse: : favorite Food) .findFirst() .orElse ("");
Given the diagram, what statements need to be in module-info.java for the mammal module? (Choose three.) A. exports mammal;B. exports mammal.eat;C. requires animal;D. requires animal.util;E. requires milk;F. requires milk.store; animal animal.util milk milk.store mammal mammal.eat panda
Given the previous diagram and the following module-info.java for the panda module, what change can be made to the requires statement? A. exports transitive mammal;B. exports transitive mammal.eat;C. requires transitive animal;D. requires transitive animal.util;E. transitive requires
Given the diagram in question 78 and the following module-info.java for the panda module, what is the result of including line m1? A. Any modules that require mammal will automatically get panda as well.B. Any modules that require panda will automatically get mammal as well.C. There is no
How many service providers are allowed to implement a service provider interface and have the consumer reference the first one? A. Exactly oneB. Exactly twoC. One or twoD. One or more.E. None of the above
Which of the following are modules supplied by the JDK? (Choose three.)A. java.loggingB. java.javadocC. java.jdkD. java.managementE. java.namingF. java.scripts.
Which are true of a JAR file that has only one module-info.class file, placed in the META-INF directory? (Choose two.)A. It is an automatic module if on the classpath.B. It is an automatic module if on the module path.C. It is a named module if on the classpath.D. It is a named module if on the
The service locator and service provider interface share a module. Which boxes represent the consumer and service provider, respectively? A. X and YB. X and ZC. Y and ZD. Z and ZE. Z and YF. None of the above. X Y Z
What statements are most accurate about the ServiceLoader class? (Choose two.)A. load() does not take any parameters.B. load() takes the class type as a parameter.C. When looping through the results of load(), you need to call the get() method on Provider.D. When using the results of load() in
Suppose we have an automatic module on the module path named lizard-^-cricket-^-1.0.0-SNAPSHOT.jar and no Automatic-Module-Name specified. What module name should named modules use to reference it? A. lizard-cricketB. lizard.cricketC. lizard-cricket-SNAPSHOTD. lizard-cricket.SNAPSHOTE. None
What file formats are legal for a module to be distributed?A. jarB. jmodC. zipD. jar and jmodE. jar and zipF. jmod and zip.
Why is this module-info incorrect for a service provider? A. The exports directive should be export.B. The exports directive should not be present because all calls to the service provider should use the service locator.C. The provides directive should be uses instead.D. The provides directive
How many modules are part of the cyclic dependency? A. 0B. 1C. 2D. 3E. 4 module.com.light { exports com.light; } module com.plant { exports com.plant; requires com.light; requires com.animal; } module com.animal { exports com.animal; requires com.light; } module com.worm { } exports com.worm;
What statements are true about requires mandated java.base? (Choose two.)A. This output is expected when running the java --list-modules command.B. This output is expected when running the java --show-module-resolution command.C. This output is expected when running the jdeps command.D. This
Which of the following methods is not available on an ExecutorService instance? (Choose two.) A. execute(Callable)B. shutdownNow()C. submit(Runnable)D. exit()E. submit(Callable)F. execute(Runnable)
The following program simulates flipping a coin an even number of times. Assuming five seconds is enough time for all of the tasks to finish, what is the output of the following application? A. falseB. trueC. The code does not compile.D. The code hangs indefinitely at runtime.E. The code
Which of the following is a recommended way to define an asynchronous task?A. Create a Callable expression and pass it to an instance of an Executor.B. Create a class that extends Thread and override the start() method.C. Create a Runnable lambda expression and pass it to a Thread
Given the following program, how many times is Locked! expected to be printed? Assume 100 milliseconds is enough time for each task created by the program to complete. A. One time.B. Five times.C. The code does not compile.D. The code hangs indefinitely at runtime.E. The code throws an
Given the original array, how many of the following for statements result in an exception at runtime, assuming each is executed independently? A. Zero.B. One.C. Two.D. Three.E. Four.F. The code does not compile. var original = List.of (1,2,3,4,5); var copy1 = new CopyOnWriteArrayList (original);
Fill in the blanks: ______________ is a special case of ______________, in which two or more active threads try to acquire the same set of locks and are repeatedly unsuccessful. A. Deadlock, livelockB. Deadlock, resource starvationC. Livelock, resource starvationD. Resource starvation, race
What is the output of the following application? A. nullB. 1nullC. 1D. Line 6 does not compile.E. Line 8 does not compile.F. An exception is thrown at runtime. 3: public class TpsReport { 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:} public void submitReports () { var s = Executors.newCached
Which of the following static methods does not exist in the Executors class? (Choose two.)A. newFixedScheduledThreadPool()B. newThreadPool()C. newFixedThreadPool(int)D. newSingleThreadExecutor()E. newScheduledThreadPool(int)F. newSingleThreadScheduledExecutor()
How many times does the following application print Ready at runtime? A. Zero.B. One.C. Three.D. The code does not compile.E. An exception is thrown at runtime. package parade; import java.util.concurrent.*; public class CartoonCat { private void await (CyclicBarrier c) { try { c. await (); }
Let’s say you needed a thread executor to create tasks for a CyclicBarrier that has a barrier limit of five threads. Which static method in ExecutorService should you use to obtain
The following diagrams represent the order of read/write operations of two threads sharing a common variable. Each thread first reads the value of the variable from memory and then writes a new value of the variable back to memory. Which diagram demonstrates proper synchronization? [4] [54] 1@#R
What is the output of the following application? A. Hare won the race! is printed first.B. Tortoise won the race! is printed first.C. The code does not compile.D. The code hangs indefinitely at runtime.E. The code throws an exception at runtime.F. The output cannot be determined ahead of
Which of the following concurrent collections is sorted? (Choose two.)A. ConcurrentSkipListB. ConcurrentSkipListSetC. CopyOnWriteArrayListD. ConcurrentSkipListMapE. ConcurrentLinkedQueueF. LinkedBlockingQueue.
What is the output of the following application? A. [Filing]B. [Filing]3.14159C. [Filing]null 3.14159D. The declaration of f1 does not compile.E. The declaration of f2 does not compile.F. The output cannot be determined ahead of time. package taxes; import java.util.concurrent.*; public
Assuming 10 seconds is enough time for all of the tasks to finish, what statements about the following program are correct? (Choose two.) A. The code does not compile.B. The incrementBy10() method is thread-safe.C. The incrementBy10() method is not thread-safe.D. The output is 1000 on every
What is the most likely result of executing the following application? A. A deadlock is produced at runtime.B. A livelock is produced at runtime.C. The application completes successfully.D. The code does not compile.E. The code hangs indefinitely at runtime.F. The output cannot be determined
Which ScheduledExecutorService method can result in the same action being executed by two threads at the same time?A. scheduleAtFixedDelay()B. scheduleAtFixedRate()C. scheduleWithFixedDelay()D. scheduleAtSameRate()E. scheduleWithRate()F. None of the above.
What is the output of the following application? A. A deadlock is produced at runtime.B. A livelock is produced at runtime.C. 1000D. The code does not compile.E. The result is unknown until runtime because stroke is not written in a thread-safe manner and a write may be lost.F. None of the
Which of the following is most likely to be caused by a race condition?A. A thread perpetually denied access to a resourceB. A program hanging indefinitelyC. An int variable incorrectly reporting the number of times an operation was performedD. Two threads actively trying to restart a blocked
Which statement about the following class is correct? A. The code compiles and is thread-safe.B. The code compiles and is not thread-safe.C. The code does not compile because of the size() method.D. The code does not compile because of the getValue() method.E. The code does not compile for
Which two method names, when filled into the print2() method, produce the same output as the print1() method? Assume the input arguments for each represent the same non-null numeric value. A. decrementAndGet() and getAndIncrement()B. decrementAndGet() and incrementAndGet()C. getAndDecrement()
How many lines of the following code snippet contain compilation errors? A. NoneB. OneC. TwoD. ThreeE. None of the above. 11: ScheduledExecutorService t = Executors 12: 13: Future result = t.execute 14: t.invokeAll (null); 15: t.scheduleAtFixed Rate (() -> {return;},5, TimeUnit. MINUTES);
How many times does the following application print W at runtime? A. 0B. 10C. 12D. The code does not compile.E. The output cannot be determined ahead of time.F. None of the above. package crew; import java.util.concurrent.*; import java.util.stream.*; public class Boat { private void
Using the Boat class from the previous question, what is the final state of the application?A. The application produces an exception at runtime.B. The application terminates successfully.C. The application hangs indefinitely because the ExecutorService is never shut down.D. The application
Given the following program, how many times is TV Time expected to be printed? Assume 10 seconds is enough time for each task created by the program to complete. A. One time.B. Three times.C. The code does not compile.D. The code hangs indefinitely at runtime.E. The code throws an exception
Given the original array, how many of the following for statements enter an infinite loop at runtime, assuming each is executed independently? A. Zero.B. One.C. Two.D. Three.E. Four.F. The code does not compile. var original = new ArrayList (List.of (1,2,3)); var copy1 = new ArrayList
Which ExecutorService method guarantees all running tasks are stopped in an orderly fashion? A. shutdown()B. shutdownNow()C. halt()D. shutdownAndTerminate()E. None of the above.
Assuming 10 seconds is enough time for all of the tasks to finish, what is the output of the following application? A. 0B. 125C. -125D. The code does not compile.E. The result is unknown until runtime.F. An exception is thrown. import java.util.concurrent.*; public class Bank { static int
What is the output of the following application? A. trueB. falseC. The code does not compile.D. The result is unknown until runtime.E. An exception is thrown.F. None of the above. import java.util.*; public class SearchList { private List data; private boolean foundMatch = false; public
The following code snippet results in an exception at runtime. Which of the following is the most likely type of exception to be thrown? A. AtomicMoveNotSupportedExceptionB. DirectoryNotEmptyExceptionC. FileAlreadyExistsExceptionD. The code does not compile.E. None of the above. var
What is the result of compiling and executing the following program? A. The code does not compile.B. The code compiles and prints a NullPointerException at runtime.C. The code compiles but does not print anything at runtime.D. The code compiles and prints the value the user enters at
Assuming the file path referenced in the following class is accessible and writable, what is the output of the following program? (Choose two.) A. 1B. 23C. 13D. The code does not compile.E. If the code compiles or the lines that do not compile are fixed, then the last value output is 3.F. If
What is the expected output of the following application? Assume the directories referenced in the class do not exist prior to the execution and that the file system is available and able to be written. A. One line of this application does not compile.B. Two lines of this application do not
Which classes are least likely to be marked Serializable. (Choose two.)A. A class that monitors the state of every thread in the application.B. A class that holds data about the amount of rain that has fallen in a given yearC. A class that manages the memory of running processes in an
What is the output of the following code snippet? Assume that the current directory is the root path. A. /lost/blue.txt and /lost/blue.txt/keysB. /found/../keys/./lost/blue.txt and /lost/blue.txt/keysC. /found/../keys/./lost/blue.txt and keysD. /lost/blue.txt and
Fill in the blanks: Writer is a(n) ______________ that related stream classes ______________.A. concrete class, extend.B. abstract class, extend.C. abstract class, implement.D. interface, extend.E. interface, implement.F. None of the above.
Assuming /away/baseball.txt exists and is accessible, what is the expected result of executing the following code snippet? A. A new file /home/baseball.txt is created.B. A new file /home/away/baseball.txt is created.C. The code does not compile.D. The code compiles, but an exception is printed
Assuming the file referenced in the following snippet exists and contains five lines with the word eggs in them, what is the expected output? A. No lines will be printed.B. One line will be printed.C. Five lines will be printed.D. More than five lines will be printed.E. The code does not
What is the output of the following program? Assume the file paths referenced in the class exist and are able to be written to and read from. A. 1,RedB. 2,GreenC. 2,nullD. 3,PurpleE. 4,nullF. null,nullG. None of the above. import java.io.*; public class Vegetable implements Serializable {
Why does Console readPassword() return a char array rather than a String?A. It improves performance.B. It improves security.C. Passwords must be stored as a char array.D. String cannot hold the individual password characters.E. It adds encryption.F. None of the above.
Given the following class inheritance diagram, which two classes can be placed in the blank boxes? A. BufferedOutputStream and PrintStreamB. BufferedOutputStream and PrintOutputStreamC. ByteArrayOutputStream and StreamD. FileOutputStream and OutputStreamE. ObjectOutputStream and
How many lines of the following code contain compiler errors? A. All of the lines compileB. OneC. TwoD. ThreeE. Four or more. 12: var path = Paths.get(new URI("ice.cool")); 13: var view = Files.readAttributes (path, BasicFileAttributes.class); 14: 15: Files.createDirectories
What is the output of the following application? A. -2B. 2C. 3D. 5E. 7F. An exception is thrown at runtime. import java.io.*; public class TaffyFactory { public int getPrize (byte[] luck) throws Exception { try (InputStream is = new ByteArrayInputStream (luck)) { is.read(new byte[2]); } if
What is the output of the following program? Assume the file paths referenced in the class exist and are able to be written to and read from. A. 2,null,REDB. 2,null,BLUEC. 3,10.0,REDD. 3,10.0,BLUEE. 0,null,nullF. None of the above. package heart; import java.io.*; public class Valve
Given the following file system diagram, in which forward is a symbolic link to the java directory, which values if inserted into the following code do not print /java/Sort.java at runtime? (Choose
Which method defined in Reader can be used in place of calling skip(1)? A. jump()B. mark()C. markSupported()D. read()E. reset()F. None of the above.
The Rose application is run with an input argument of /flower. The /flower directory contains five subdirectories, each of which contains five files. What is the result of executing the following program? A. The program completes without outputting anything.B. One Path value is printed.C. Six
What may be the result of executing the following program? A. The program asks the user a question and prints the results to the error stream.B. The program throws a NullPointerException at runtime.C. The program does not terminate.D. All of the above.E. The class does not compile. package
What is the output of the following method applied to an InputStream that contains the first four prime numbers, stored as bytes: 2, 3, 5, 7? A. 5B. 7C. The code does not compile.D. The code compiles but throws an exception at runtime.E. The result cannot be determined until runtime.F. None
Which statement about the following method is correct? Assume the directory /tea/ earlGrey/hot exists and is able to be read. A. It does not compile.B. It compiles but does not print anything at runtime.C. It compiles and prints true exactly once at runtime.D. It compiles and prints true at
Which method are classes that implement java.io.Serializable required to implement?A. cereal()B. deserialize()C. serial()D. serialize()E. clone()F. None of the above.
What is the result of compiling and executing the following program? Assume the current directory is /stock and the path /stock/sneakers does not exist prior to execution. A. The directory /stock/sneakers is created.B. Line j1 does not compile or produces an exception at runtime.C. Line j2 does
Assuming the absolute path referenced in the code exists and its contents are accessible, which statement about the following code snippet is correct? A. The first stream statement does not compile.B. The second stream statement does not compile.C. Neither statement compiles.D. Both statements
When reading file information, what is an advantage of using an NIO.2 attribute interface rather than reading the values individually using Files methods? (Choose two.) A. Costs fewer round-trips to the file systemB. Guarantees performance improvementC. Has support for symbolic linksD. Reduces
Suppose that you need to read data that consists of serialized int, double, boolean, and String values from a file. You also want the program to be performant on large files. Which three java.io stream classes can be chained together to best achieve this result? (Choose
Which statement about the following method is correct? Assume the directory coffee exists and is able to be read. A. It does not compile.B. It compiles but does not print anything at runtime.C. It compiles and prints true exactly once at runtime.D. It compiles and prints true at least
Assuming the file referenced in the StudentManager class exists and contains data, which statement about the following class is correct? (Choose two.) A. The code does not compile.B. The code compiles but prints an exception at runtime.C. The program runs and prints all students in the
Given an instance of Console c, which of the following two method calls are invalid ways of retrieving input from the user? (Choose two.)A. c.read()B. c.reader().read()C. c.reader().readLine()D. c.readLine()E. c.readPassword()
What is the output of the following code snippet? Assume that the current directory is the root path /. A. ../found/red.zip and ../../locksB. /found/red.zip and /found/red.zip/./locksC. locks/../found/red.zip and ../found/locksD. ../../locks and ../found/red.zipE. /found/red.zip and
Assuming the current working directory is /home, then what is the output of the following program? A. /home/tricksB. /homeC. tricksD. The code does not compile.E. The code compiles but prints an exception at runtime.F. None of the above. 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: package
Which statements about the Files methods lines() and readAllLines() are correct? (Choose two.)A. They have different return types.B. The readAllLines() method is always faster.C. The lines() may require more memory.D. They have the same return type.E. The lines() method is always
Given the following application, in which a user enters bone twice, what is the expected result? A. The program completes after printing a message once.B. The program completes after printing a message twice.C. An IOException is thrown.D. The program prints an exception because the format of
What is the expected result of calling deleteTree() on a directory? Assume the directory exists and is able to be modified. A. It will delete the directory itself only.B. It will delete the directory and its file contents only.C. It will delete the entire directory tree.D. The code does not
Which code, if inserted into the method, will cause it to correctly copy any file passed to it that is accessible? (Choose two.) void copyFile(String source, String target) throws Exception { try (var is = new FileInputStream (source); } } OutputStream os = new FileOutputStream (target)) { byte[]
Let’s say we want to write an instance of Cereal to disk, having a name value of CornLoops and sugar value of 5. What is the value of name and sugar after this object has been read from disk using the ObjectInputStream’s readObject() method?A. CaptainPebbles and 10B. CornLoops and
During deserialization from an I/O stream, which element of the class can be used to assign a value to the deserialized object? A. Variable initializerB. Instance initializerC. Static initializerD. ConstructorE. The restoreObject() methodF. None of the above
Assuming there are no symbolic links involved and file ursery/sapling.seed exists, which statements about the following code snippet are correct? (Choose three.) A. The code may throw an exception at runtime.B. The code may complete without throwing an exception at runtime.C. After it runs, the
What is the output of the following application? Assume /all-data exists and is accessible within the file system. A. The code does not compile.B. The number of lines in all files in a directory tree.C. The number of lines in all files in a single directory.D. The code hangs indefinitely at
The following figure represents a stream pipeline. Given this, would the boxes X, Y, Z best represent?A. Origin, intermediate operation, and final operation B. Origin, intermediate operation, and sink C. Origin, intermediate operation, and terminal operation D. Source, intermediate operation,
Showing 400 - 500
of 1045
1
2
3
4
5
6
7
8
9
10
11
Step by Step Answers