In Matplotlib, the ____ function is used to add text annotations in arbitrary locations of the plot.

  • annotate
  • caption
  • label
  • text
In Matplotlib, the annotate function is used to add text annotations in arbitrary locations of the plot. These annotations can be used to provide additional information about data points, labels, or other details on the plot.

The ____ method in the unittest framework is used to compare whether two values are equal.

  • assertEqual
  • checkEquality
  • compareValues
  • isEqual
In the unittest framework, the assertEqual method is used to compare whether two values are equal. It is commonly used within test cases to verify that the actual output matches the expected output. If the values are not equal, it raises an assertion error.

The ____ method in the unittest framework is used to immediately terminate a test and mark it as failed.

  • assertFail()
  • assertFailTest()
  • fail()
  • failTest()
In the unittest framework, the fail() method is used to immediately terminate a test and mark it as failed. This is useful when you want to explicitly indicate a test failure.

The ____ method is used to initialize the object’s attributes in a class.

  • construct
  • create
  • init
  • new
In Python, the __init__ method is a special method (also known as a constructor) used to initialize the attributes of an object when an instance of a class is created. It allows you to set the initial state of the object.

The ____ method is used to pre-fetch the next value of a generator object.

  • await
  • next
  • yield
  • yieldNext
The correct method to pre-fetch the next value of a generator object is the next method. It allows you to advance the generator and obtain the next yielded value.

The ____ method returns the number of occurrences of a substring in the given string.

  • count()
  • find()
  • index()
  • search()
The count() method is used to find the number of occurrences of a substring in a given string. It returns an integer representing the count.

The ____ module in Python provides a way to measure the approximate CPU time used by a process.

  • cpu
  • os
  • sys
  • time
The time module in Python provides functions for working with time, including measuring the approximate CPU time used by a process using functions like time.process_time().

The ____ sort algorithm repeatedly divides the list into two halves until each sub-list contains a single element.

  • Bubble
  • Insertion
  • Merge
  • Quick
The Merge Sort algorithm repeatedly divides the list into two halves until each sub-list contains a single element and then merges them back together in a sorted manner. It is known for its stable and efficient sorting.

The ____ statement in Python is used to verify if a given logical expression is true and raise an error if it’s false.

  • assert
  • check
  • confirm
  • validate
In Python, the assert statement is used for debugging and testing. It checks whether a given logical expression is true and raises an AssertionError if it's false, helping to catch bugs early.

The ____ statement is used to bring in an entire module into the current namespace.

  • from module import *
  • import all
  • import module
  • module import
In Python, you can use the from module import * statement to bring in all definitions from a module into the current namespace. However, it is generally recommended to use import module or from module import name to import specific functions or classes from a module.