Python's ____ allows classes to be created dynamically, at runtime.
- decorators
- inheritance
- metaclasses
- polymorphism
Python's "metaclasses" allow classes to be created dynamically, at runtime. Metaclasses are responsible for creating and configuring classes.
In which scenarios is it most appropriate to use a metaclass instead of a class?
- When you need to customize the behavior of a specific instance.
- When you want to create a simple object.
- When you want to customize the behavior of a group of classes.
- When you want to define a new data type.
Metaclasses are most appropriate when you need to customize the behavior of a group of classes, such as enforcing coding standards, implementing singletons, or automating repetitive tasks for classes. They are not typically used for customizing individual instance behavior.
In which library would you find the DataFrame data structure, commonly used in conjunction with Scikit-learn for data manipulation and analysis?
- Matplotlib
- NumPy
- Pandas
- Scikit-learn
The Pandas library is where you would find the DataFrame data structure, which is extensively used for data manipulation and analysis. While NumPy and Matplotlib serve other purposes, Pandas is the go-to library for structured data handling.
In which data structure are elements connected using pointers to form a sequence?
- Array
- Linked List
- Queue
- Stack
A linked list is a data structure where elements are connected using pointers to form a sequence. Each element (node) contains data and a reference (pointer) to the next element in the sequence. Linked lists are dynamic and allow efficient insertions and deletions in the middle of the sequence.
In web development, ____ is a technique used to update a web page without reloading it, which can be implemented using JavaScript and integrated with Python back-end.
- AJAX
- CSS
- HTML5
- JSON
In web development, AJAX (Asynchronous JavaScript and XML) is a technique used to update web content without the need to reload the entire page. It enables seamless interaction between the client and server, often implemented using JavaScript and integrated with Python back-end using APIs.
In the unittest framework, what is the significance of the setUpClass method in a test case class?
- It is called after all test methods in the test case class have run.
- It is called after the tearDown method in the test case class.
- It is called before any test methods in the test case class are run.
- It is called before each test method in the test case class.
In the unittest framework, the setUpClass method is called once before any test methods in the test case class are run. It's typically used to set up resources or configurations that are shared by all test methods in the class.
In the pytest framework, how do you mark a test function so that it is not executed by the test runner?
- @pytest.disable()
- @pytest.exclude()
- @pytest.ignore()
- @pytest.skip("Test not ready yet")
In pytest, you can use the @pytest.skip("Reason") decorator to mark a test function so that it is not executed. You can provide a reason for skipping for documentation purposes.
In the context of data visualization, ____ is a Python library that is based on Matplotlib and provides a high-level interface for drawing attractive and informative statistical graphics.
- NumPy
- Scikit-learn
- Seaborn
- TensorFlow
In the context of data visualization in Python, Seaborn is a library based on Matplotlib that simplifies the creation of statistical graphics, making them more attractive and informative.
In Seaborn, which function is used to create a scatter plot with the possibility of several semantic groupings?
- sns.boxplot()
- sns.lineplot()
- sns.pairplot()
- sns.scatterplot()
In Seaborn, the sns.scatterplot() function is used to create scatter plots with the possibility of several semantic groupings. It allows you to color and style the points based on additional variables, making it useful for exploring relationships in complex datasets.
In Seaborn, the ____ function is used to plot univariate or bivariate distributions of observations.
- distplot
- plot_distribution
- scatterplot
- univariate
In Seaborn, you use the distplot function to plot univariate distributions of observations. It's a versatile function that can display histograms, kernel density estimates, and more.
In Seaborn, how can you visualize the linear relationship between two variables?
- Heatmap
- Pair plot
- Regression plot
- Scatter plot
To visualize the linear relationship between two variables in Seaborn, you can use a regression plot. It shows a scatter plot of the data points with a regression line, helping you assess the strength and direction of the linear relationship.
In Scikit-learn, the ____ method is used to calculate the accuracy of the model on the test data.
- evaluate
- fit
- predict
- score
In Scikit-learn, the score method is used to calculate various metrics, including accuracy, to evaluate the performance of a machine learning model on test data. This method compares the model's predictions to the true labels and returns the accuracy score.