Making a new thread about this because I think it's worth getting to the bottom of the issue.
Question 20 is either an unexplained trick question or a mistake in the sample answers. I'd like to explain why I think it is, or should be treated as, the latter.
I'll start by addressing the two points of contention mentioned in this thread:
Suppose I write a complete C code with a main() and do not call this function?
The fork() system call doesn't exist on Windows, which is why it isn't guaranteed to work.
The question reads as follows:
If the above code executes successfully, which of the following statements will always be true?
It opens with a condition: that the above code 1) executes, and 2) executes successfully. This means that the first point - what if I don't call the function - is invalid, because the condition asserts that the code executes, which means the function must have been called. It also means that the second point - what if fork()
doesn't work - is invalid, because then the code would not have "executed successfully", and hence the question would not apply. I should also add, as was noted in the tutorial on Fri 13th, it uses similar phrasing to various other questions (8, 10, 13).
Now I'd like to draw attention to a quote from Prof. Datta:
I don't know what Chris had mind, it could be a trick question
This is an admission that he (the current Unit Coordinator) cannot explain why the answer is what was given. In the absence of an explanation from the original test setter, I think the question should either be nullified or have (C) considered to be the correct answer. It does not make any sense for the question to remain as it is when the vast majority - including the UC - believe it to be at best misleading (at worst incorrect), with a clear alternate answer accepted as de facto correct.
Furthermore, there is already ample precedent for Prof. Datta changing parts of the unit to fit his teaching style. To be clear, I'm not critical of that in principle, but if there is any contention around overriding Dr. McDonald's UC decisions, that ship has clearly already sailed.
Unless someone can produce a counter example - where the code both executes successfully and does not "output "hello world" exactly four times, on four separate lines" - I think it's clear that the supplied answer is, or should be considered to be, incorrect. If the UC cannot defend a decision, then he can and should change it.