In Pandas, how do you access the first five rows of a DataFrame?

  • df.head()
  • df.iloc[:5]
  • df.loc[:5]
  • df[0:5]
To access the first five rows of a Pandas DataFrame, you should use the head() method, like df.head(). This method returns the top N rows (default is 5) of the DataFrame.

In pytest, the ____ fixture is used to execute specific finalization code after the test function has completed.

  • cleanup
  • finalize
  • teardown
  • yield_fixture
In pytest, the teardown fixture is used to execute finalization code after the test function has completed its execution. This allows you to perform cleanup tasks or teardown actions after the test has run, such as closing a database connection or cleaning up temporary files.

In pytest, the ____ fixture is used to pass command-line options to test functions.

  • @pytest.cmdline
  • @pytest.config
  • @pytest.fixture(params)
  • @pytest.options
In pytest, the @pytest.config fixture is used to pass command-line options and configuration values to test functions. This allows you to customize the behavior of your tests based on configuration settings.

In pytest, the ____ marker is used to skip a test function under certain conditions.

  • @pytest.ignore
  • @pytest.run
  • @pytest.skip
  • @pytest.xfail
In pytest, the @pytest.skip marker is used to skip a test function when certain conditions are met. This allows you to selectively skip tests based on runtime conditions or configurations.

In Python, ____ is used to access the attributes and methods of a class.

  • Class
  • Dot notation
  • Inheritance
  • Object
In Python, you use the dot notation (.) to access the attributes and methods of a class. For example, object.attribute or object.method().

In Python, ____ is used to define a function that takes an arbitrary number of positional arguments.

  • def *args
  • def arguments
  • def function
  • def varargs
In Python, the syntax def function_name(*args) is used to define a function that can take an arbitrary number of positional arguments. The *args syntax allows you to pass a variable number of arguments to the function.

In Matplotlib, the ____ method is used to create a new figure object.

  • create_figure
  • figure
  • new_figure
  • plot
In Matplotlib, the figure method is used to create a new figure object. A figure object is like a canvas where you can add multiple subplots or axes to create complex plots with multiple elements. It is an essential step when working with Matplotlib.

In Matplotlib, the ____ method is used to set the labels of the x-axis.

  • set_x_axis
  • set_x_label
  • set_xlabel
  • x_labels
In Matplotlib, you use the set_xlabel method to set the label for the x-axis. This method allows you to specify the label that appears below the x-axis in your plot.

In NumPy, the ____ function is used to calculate the element-wise maximum of two arrays.

  • max
  • maximize
  • maximum
  • min
In NumPy, the maximum function is used to calculate the element-wise maximum of two arrays. It returns a new array containing the element-wise maximum values from the input arrays.

In Flask, the ____ object is used to store data that is accessible from all parts of an application.

  • app
  • request
  • route
  • session
In Flask, the session object is used to store data that is accessible across different parts of an application. It allows you to store user-specific data, such as login information or shopping cart contents, across multiple requests.