When all of the operations in a function contribute to the performance of only one task, a function has

singular cohesion
tight cohesion
functional cohesion
sequential cohesion

The correct answer is: A. singular cohesion

Singular cohesion is the highest level of cohesion, and it occurs when all of the operations in a function contribute to the performance of only one task. This means that the function has a single, well-defined purpose, and all of its code is focused on achieving that purpose.

Tight cohesion is a lower level of cohesion than singular cohesion. It occurs when all of the operations in a function contribute to the performance of a related set of tasks. This means that the function has a general purpose, but it is still focused on a specific set of related tasks.

Functional cohesion is the lowest level of cohesion. It occurs when the operations in a function contribute to the performance of a task, but the function does not have a single, well-defined purpose. This means that the function may be doing multiple things, and it may not be clear what its main purpose is.

Sequential cohesion is not a type of cohesion. It is a term that is sometimes used to describe a function that has multiple operations that are performed in a specific order. However, this does not necessarily mean that the function has high cohesion. A function with sequential cohesion could still have low cohesion if the operations are not related to each other.

In conclusion, the correct answer is: A. singular cohesion.

Exit mobile version