This is my view on the above question -
Definitions -
Race Condition - A section of code where if multiple threads/processes execute it the final outcome is undefined and depends upon the order in which the execute. Thus some sort of mutual exclusion is required to avoid this condition
Mutual exculusion - A mutual exclusion (mutex) is a program object that prevents simultaneous access to a shared resource.
Process Synchronization - Process Synchronization means sharing system resources by processes in a such a way that, Concurrent access to shared data is handled thereby minimizing the chance of inconsistent data
Thus Semaphores are used to solve the problem of Race condition, Mutual exclution, process synchronization.
Ref - https://www.winemantech.com/blog/avoiding-race-conditions-with-labview-programming/
There are few arguments that Semaphore does not gurantee the freedom from race condition. Yes its true as improper use of Semaphore will not gurantee freedom from race condition. However, this argument is invalid as the question never asked which of the following is defintely solved by Semaphore. It is asking Semaphore is used to solve?
Also if the above argument is used then in that case even improper use of Semaphore will not gurantee mutual exclusion.
For example ,
struct semaphore {
Queue L;
int value
} mutex;
up( mutex )
Critical section
up( mutex)
In the above code there is use of semaphore but fails to gurantee mutual exclusion.
The answer to the question could be option C) or B) depending upon what the question setter had in his mind.
If By All of above he meant 1, 2, 3 and not including None of the above the correct option is C) All of above
If really its a tricky question and All of above includes None of above then most appropriate option will be B)