The ____ method in the unittest framework is used to clean up the resources used during the test.

  • cleanup
  • finalize
  • setUp
  • tearDown
In the unittest framework, the tearDown method is used to clean up any resources or perform cleanup tasks after a test has been executed. It is often used to release resources like file handles, database connections, or temporary files created during the test.

The ____ method in TensorFlow or PyTorch is used to apply gradients to variables.

  • apply_gradients
  • backpropagate
  • compute_gradients
  • optimize
In TensorFlow and PyTorch, the apply_gradients method is used to apply gradients to variables. Gradients represent the direction and magnitude of changes needed to optimize a model's parameters during training. The apply_gradients method is an essential step in the optimization process.

The ____ method in Seaborn is used to draw a box plot to show distributions with respect to categories.

  • boxplot
  • categoryplot
  • drawbox
  • plot_box
In Seaborn, the boxplot method is used to draw a box plot, also known as a box-and-whisker plot. This type of plot is valuable for visualizing the distribution of data, including measures such as median, quartiles, and outliers, across different categories or groups.

The ____ method in Python web frameworks is used to handle HTTP POST requests from the client.

  • DELETE
  • GET
  • POST
  • PUT
In Python web frameworks like Flask and Django, the POST method is used to handle HTTP POST requests from the client. This method is commonly used for submitting data to the server, such as form submissions.

The ____ method in Python is used to initialize a newly created object and is called every time the class is instantiated.

  • constructor
  • destructor
  • generator
  • initializer
The "constructor" method in Python is used to initialize a newly created object and is called every time the class is instantiated. This method is typically named __init__ in Python classes.

The ____ method in Pandas is used to drop specified labels from rows or columns.

  • delete
  • discard
  • drop
  • remove
In Pandas, the drop method is used to drop specified labels (rows or columns) from a DataFrame. This method provides options to control whether the operation should be performed in place or return a new DataFrame.

The ____ method in Pandas DataFrame is used to rearrange the order of the DataFrame's columns.

  • rearrange()
  • reindex()
  • reorder_columns()
  • sort()
In Pandas DataFrame, the reorder_columns() method is used to rearrange the order of the DataFrame's columns. This method allows you to specify the new order of columns using a list or other methods like loc.

The ____ method in generator objects is used to resume the generator and send a value back to it.

  • next
  • resume
  • send
  • yield
The send method is used to resume a generator and send a value back to it. This is commonly used for implementing two-way communication with a generator.

The ____ method in a metaclass is called when a new object is created from a class.

  • __del__
  • __init__
  • __new__
  • __str__
The __new__ method in a metaclass is called when a new object is created from a class. This method is responsible for creating and returning a new instance of the class.

The ____ keyword in Python is used to define conditions under which a block of code will be executed.

  • if
  • switch
  • try
  • while
In Python, the 'if' keyword is used to define conditions for conditional execution of code blocks. Code within an 'if' block is executed only if the specified condition evaluates to true.

The ____ function in the functools module is used to transform a method into a class method decorator.

  • classmethod
  • decorator
  • method2class
  • staticmethod
The classmethod function in the functools module is used to transform a method into a class method decorator. Class methods can be called on the class itself rather than on instances of the class.

You need to normalize a NumPy array so that the values range between 0 and 1. How would you achieve this?

  • Using Exponential Transformation: np.exp(arr)
  • Using Min-Max Scaling: (arr - arr.min()) / (arr.max() - arr.min())
  • Using Square Root Transformation: np.sqrt(arr)
  • Using Standardization: (arr - arr.mean()) / arr.std()
To normalize a NumPy array to the range [0, 1], you should use Min-Max Scaling. It involves subtracting the minimum value of the array from each element and then dividing by the range (the difference between the maximum and minimum values). This method scales the data linearly to the desired range.