exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 125 discussion

Actual exam question from Oracle's 1z0-819
Question #: 125
Topic #: 1
[All 1z0-819 Questions]

Which statement is true?

  • A. PrintWriter outputs characters and automatically flushes the stream.
  • B. System.exit() invokes the close() method for the InputStream/OutputStream resources.
  • C. Console.readPassword() method encrypts the text entered.
  • D. PrintStream outputs only bytes.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ASPushkin
1 month, 3 weeks ago
Selected Answer: A
A right a text-output stream. automatic flushing is enabled B. fail it can have registered shutdown hooks (threads) C password is not encrypted it just suppresses echoing, so the password is not visible on the user's screen. D. Fail a text-output stream.
upvoted 1 times
...
cathDev
3 months ago
Selected Answer: A
A. PrintWriter: It is used for writing text data to a character stream. It automatically flushes the stream after writing, ensuring that the data is immediately sent to the output destination.
upvoted 1 times
...
d7bb0b2
6 months ago
Selected Answer: A
PrintWriter has methods that allow character output. Additionally, PrintWriter has an option for auto-flushing that can be enabled in the builder. When enabled, certain write and println methods will automatically flush the output buffer.
upvoted 1 times
...
d7bb0b2
7 months ago
The correct answer is A. PrintWriter outputs characters and automatically flushes the stream. Explanation: A. PrintWriter is a class in Java that outputs characters to an output stream and automatically flushes the stream when a newline character is written, when the println method is invoked, or when a carriage return character is written. B. System.exit() does not invoke the close() method for the InputStream/OutputStream resources. It terminates the currently running Java Virtual Machine (JVM). It's the responsibility of your code to close streams before exiting. C. Console.readPassword() does not encrypt the text entered. It simply disables echoing, so the password is not displayed on the console when it's entered. D. PrintStream does not output only bytes. It can output all primitive data types and strings using its print and println methods.
upvoted 1 times
...
Omnisumem
9 months, 1 week ago
Selected Answer: D
Retested. C is not true. So: D is my choice.
upvoted 1 times
...
Omnisumem
9 months, 1 week ago
Selected Answer: C
I would vote for D. Because it is fact: "All characters printed by a PrintStream are converted into bytes using the platform's default character encoding." As regards A: "... if automatic flushing is enabled ..." so it is not true always. B is not true. So I vote for C - Tested (https://www.geeksforgeeks.org/console-readpassword-method-in-java-with-examples/).
upvoted 1 times
...
[Removed]
10 months, 2 weeks ago
I find this a rather tricky one because and would like to know the answer. So what I found is that a PrintWriter doesn't automatically flushes the stream, it does however have a constructor accepting a boolean to ENABLE autoflushing.. for D.. I found this in the oracle docs: All characters printed by a PrintStream are converted into bytes using the platform's default character encoding. The PrintWriter class should be used in situations that require writing characters rather than bytes. So it's either A or D
upvoted 1 times
[Removed]
10 months, 2 weeks ago
To be fair I would answer D over A on the actual exam. As autoflushing is clearly not AUTOMATICALLY enabled.
upvoted 1 times
...
...
Stavok
11 months, 3 weeks ago
Selected Answer: A
It has a constructor that can take an OutputStream as an argument, and an optional second argument that specifies whether the stream should be automatically flushed when println is called. This means that the data is immediately written to the underlying output stream, instead of being buffered.
upvoted 1 times
...
belal97
12 months ago
Which is correct ?? i think A is false !!
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago