To find the shortest path in a graph with non-negative edge weights, the ____ algorithm can be used.
- Binary
- Bubble
- Dijkstra's
- Quick
To find the shortest path in a graph with non-negative edge weights, you can use Dijkstra's algorithm. This algorithm efficiently calculates the shortest path from a source vertex to all other vertices in a weighted graph.
To get all the keys from a Python dictionary, you can use the ____ method.
- get()
- items()
- keys()
- values()
To obtain all the keys from a Python dictionary, you should use the keys() method. This method returns a view object that displays a list of all the keys in the dictionary.
To represent a constant property in a Python class, you would typically use _____.
- const
- final
- readonly
- static
In Python, to represent a constant property in a class, you would typically use the readonly keyword. It ensures that the property cannot be modified after it's assigned a value.
The _____ method in a metaclass is executed when a new class is created.
- class
- init
- metaclass
- new
In Python, the __new__ method in a metaclass is executed when a new class is created. It allows you to customize the creation process of classes before __init__ is called.
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 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 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.
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.
The ____ algorithm is commonly used to dynamically optimize and solve overlapping subproblems.
- Backtracking
- Divide and Conquer
- Dynamic Programming
- Greedy
The Dynamic Programming algorithm is commonly used to dynamically optimize and solve overlapping subproblems. It stores the results of subproblems to avoid redundant computation.
The ____ algorithm is used to traverse all the vertices of a graph in depthward motion.
- A*
- Breadth-First Search (BFS)
- Depth-First Search (DFS)
- Dijkstra's
The Depth-First Search (DFS) algorithm is used to traverse all the vertices of a graph in a depthward motion. It explores as far as possible along each branch before backtracking.