Exam 1z0-819 All QuestionsBrowse all questions from this exam
Question 73

Given the content from lines.txt:

C -

C++

Java -

Go -

Kotlin -

and

What is the result?

    Correct Answer: C

    The code reads lines from a file, filters out lines that are equal to 'Java' (ignoring case), converts the remaining lines to uppercase, and collects them in a list. The input file consists of lines with content, none of which match 'Java' exactly (since they either have a '-' next to them or are completely different). Thus, none of the lines are filtered out due to ignoring case and not matching 'Java', and all lines are converted to uppercase. The resulting output will be the input lines with all characters in uppercase.

Discussion
ASPushkinOption: D

.filter(line -> !line.equalsIgnoreCase("JAVA") equalsIgnoreCase("JAVA") Two strings are considered equal ignoring case if they are of the same length and corresponding characters in the two strings are equal ignoring case. so all lines ARE included.

Galen86Option: C

C is the correct answer, because data that is not equal to "JAVA" is filtered line by line from the file, so there will be no JAVA in the final output.

mendjijetOption: D

D tested JAVA # JAVA-

d7bb0b2Option: D

D is correct because s read line by line and JAVA has a - , and is not equals to JAVA. if no have that space or - remove java from the final list

OmnisumemOption: D

Tested.

tmuralimanoharOption: D

Answer: D

StavokOption: D

D is Correct TESTED