A function that changes an object’s state belongs to the category of

inspector functions
mutator functions
auxiliary functions
manager functions

The correct answer is B. mutator functions.

A mutator function is a function that changes the state of an object. This is in contrast to an inspector function, which only reads the state of an object, and a manager function, which controls the flow of execution of a program.

For example, the following function is a mutator function:

def set_x(self, x):
self.x = x

This function changes the value of the x attribute of the object that it is called on.

The following function is an inspector function:

def get_x(self):
return self.x

This function returns the value of the x attribute of the object that it is called on.

The following function is a manager function:

def run(self):
# Do some work

This function controls the flow of execution of the program. It calls other functions and determines when the program should end.

I hope this explanation is helpful!

Exit mobile version