Mitchell Coutinho

Greenhorn
+ Follow
since May 07, 2024
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
1
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
Ranch Hand Scavenger Hunt
Greenhorn Scavenger Hunt

Recent posts by Mitchell Coutinho

Jeanne Boyarsky wrote:Noted on explanation needing to be different



Great. Thanks for the verification!

Yes, as you will have seen from the link I showed you, the (...) may be present or absent if you reduce the parameter list to exactly one token. As I said, the wording of the question seems not to be clear to everybody. The Java® Language Specification (=JLS) says,

If a lambda expression has exactly one formal parameter, and the parameter is specified by an identifier instead of a parameter specifier, then the parentheses around the identifier may be elided.


. . . and I don't think that is much clearer.



I appreciate the extra context. I did not find the explanation accompanying answer C to be all too confusing. I read the relevant section of the JLS that you were kind enough to reference. The section is also quite clear to me. I suspect that perhaps the rules regarding the use of parentheses were clear to Tim Mousaw as well when he submitted his feedback. The wording in his post suggests to me that the assertion made as to why answers C and F are correct are what he disagrees with, as I do.

I am in Britain, so I use the word “bracket” slightly differently from people in the USA, but please call {...} “braces.”


Hah, apologies. I'll try to keep that in mind

If no custom type has been shown, I believe the type of the λ in question F is either a Predicate<Integer, Boolean> or an IntPredicate.
...
I think, if you look up the link, you will find I should have written Predicate<Integer>.


Close enough! The question actually includes the functional interface in question. It was a Function<Integer, Boolean>.

In any case, I hope that this submission ends up being helpful for other readers taking the assessment test that could not find this in the errata on https://www.selikoff.net/ocp17/.
If this information is ever acknowledged as errata, I propose that Tim Mousaw is listed as the reporter for his initial post on the subject.
Thanks for the reply and for linking the other person's post, Campbell Ritchie.

Regarding answer C, what trips me up are not so much the rules regarding Lambda's and their various allowed syntaxes. Nor does the fact that answer C is correct surprise me. That much is quite clear to me.
Rather, what trips me up is the explanation of why answer C is correct.
Specifically, the explanation for answer C states that  "Lambda expressions with one parameter are allowed to omit the parentheses around the parameter list, making option C correct".

Sure, it is merely stated that parentheses are allowed to be omitted, and so you can infer that they may either be present or absent. In that sense, the explanation of this rule regarding lambda's contains no mistake.

But the fact that it is allowed to omit parentheses most certainly does not make option C correct. In fact, the fact that parentheses are allowed to be omitted has no relationship to the correctness of answer C at all, since in answer C the parentheses are not omitted.

Phrased differently, the stated rule is that parentheses may be omitted. The argument is that this rule makes option C correct.

But if this rule did not exist, option C would still be correct since it does not omit the parentheses.
How, then, can we argue that this rule is what makes option C correct?

This is the error that I attempted to point out.

As for answer F, it uses the following syntax

Similar to answer C, the explanation states that  "the return statement is optional when a single statement is in the body, making option F correct."
I suppose that technically, if the single statement is surrounded by brackets, then the return statement must be used. And if the brackets are omitted, then a return statement may not be used. So in that sense, one could argue that the return statement is somewhat optional.


But even if we apply such a lenient interpretation to the explanation, to state that answer F is correct specifically because the return statement is optional, when in fact the return statement is not optional for F due to the braces, strikes me as a mistake.

Ironically, the text then explains that for answer B, which was , that it is incorrect because a return statement must be used when braces surround the body.

The fact that the answer to B explains how the return statement is not optional when braces are present makes the mistaken explanation for F stand out all the more prominently.
The explanation to F says that the return statement is optional. The explanation to B says that it is not for a reason that also applies to F.

I, at least, find it hard to imagine that the authors intended the explanations to C and F to be this way.
The explanation for answer 23 states that "Lambda expressions with one parameter are allowed to omit the parentheses around the parameter list, making option C correct".
However, when you look at option C, the parentheses are not omitted.

Additionally, it says "the return statement is optional when a single statement is in the body, making option F correct."
But option F has a return statement, and in fact has brackets around the body, meaning that the return statement is not optional at all.


vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |