I would mark answer A and then would appeal first to try to accept my answer, and if it is not possible to challenge the question. Unless, of course, someone officially justified the answer in a plausible manner.
I can’t see an execution error there, it’s a simple algorithm and "manly".
To say that you have a logic error there should be a definition of what the problem is. This is not present, so it is not possible to assign a logic error in something you do not know what to do.
To say that there is a semantic error it is necessary to know the rules of the programming language, even a more abstract language. There are several algorithm languages, each with its own rules.
Within the language of algorithm I know and within what I hope this algorithm does, there is no mistake.
What one can claim is that the average is being calculated over an integer value. But for me it’s okay to do this. Only a definition of accepting decimal values would make a logic error.
This error of logic in theory could be the consequence of a semantic error, although I doubt, I think that the semantic would make the execution impossible before it, and fixing the logic would be correct. Semantics could compel you to make a conversion in order to make this calculation, but how will I know in something so abstract?
Someone could claim to accept any amount. I doubt that’s a need for such a simple algorithm, but if it is, there should be a problem defining this.
The algorithm does everything correctly within what intuitiveness determines, it cannot go beyond it. If something is missing it is the fault of the wrong question asked and she cannot demand that the person reading it knows what it is.
In addition I ran in an "IDE" that understands this algorithm and executed without apparent errors. Of course I had to make adaptations because none I found used this syntax of the question.
Probably I would justify in proof my choice. I don’t know how much this could help anything.
It may be that the question was based on some booklet that one should study beforehand. Then everything changed, would have to answer what the apostille says, even if it is wrong, because the contest is trying to determine who memorized the apostille.
This is the kind of question that falls into contest? I would find it easy, but apparently there are things in these questions that I can not see. I wonder how it is possible to point out a logic error if it has not written in lufar some what is the logic to be followed, ie there is a defined problem. The semantic error depends on the algorithm language. Where does it say which language? Do you have to guess? Or is it implied by something else that is not apparent in the question? Alias, proof of contest with Portuguese error, wonder...
– Maniero
Related: What is the difference between syntactic error and semantic error?
– rray
@rray do not know, this is assumption. If the proof was made by someone who does not know Portuguese, imagine if you know how to make a question that makes sense. I would enter with feature imputing at least the question. The question itself has: A) no error; B) misspelling; C) grammatical error; D) both
– Maniero
I don’t see any mistakes there. By the way, I have already given some contests, and usually who makes the computer issues clearly is not in the area;
– Bacco
Still I am curious for someone to point out some mistake there. Suddenly there is some VERY discreet prank. Now, if the plaintiff claims that the error is a
←
in place of=
, have to pick up rubber slippers in the face, because nothing prevents←
be the symbol of attribution of this language. By the way, very semantic this arrow for attribution. It should only be boring to type.– Bacco