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 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.
In Flask, to register a function to run before each request, you would use the ____ decorator.
- @before_render
- @before_request
- @pre_request
- @request_handler
In Flask, the @before_request decorator is used to register a function that runs before each request to the application. This is often used for tasks like setting up database connections or authentication checks.
In Flask, what is the purpose of the route() decorator?
- It authenticates user access to certain routes
- It defines the routing logic for the application
- It defines the schema for the database
- It specifies the URL for the static files
In Flask, the @app.route() decorator is used to define the routing logic for the application. It associates a URL with a Python function, allowing you to determine what should happen when a user accesses a particular URL.
In machine learning, ____ is a technique used to choose the hyperparameters for a given model.
- Cross-Validation
- Feature Engineering
- Gradient Descent
- Hyperparameter Tuning
Hyperparameter tuning is the process of selecting the optimal hyperparameters for a machine learning model to achieve the best performance. It is a crucial step in model development.
In Matplotlib, how do you add a title to a plot?
- plt.add_title()
- plt.plot_title()
- plt.set_title()
- plt.title()
In Matplotlib, you add a title to a plot using the plt.title() function. This function takes a string as an argument and sets it as the title of the plot. Titles are essential to provide context and information about the content of the plot.