How can you customize the appearance of your plots in Matplotlib, like setting the line width, color, and style?

  • By modifying the plt.style attribute
  • By passing arguments to Matplotlib plotting functions
  • By using the plot_format() method
  • Using the customize() function
In Matplotlib, you can customize plot appearance by passing various arguments like linewidth, color, and linestyle directly to the plotting functions (e.g., plot() or scatter()). This allows you to control the line width, color, and style for individual elements in your plot.

How can you access the sqrt function from the math module?

  • math.sqrt(x)
  • math::sqrt(x)
  • math->sqrt(x)
  • sqrt(x)
To access the sqrt function from the math module, you should use the dot notation like math.sqrt(x). This allows you to access functions or properties within a module in JavaScript.

How can you achieve inheritance in Python?

  • By creating a subclass that inherits from a superclass
  • By defining a superclass variable
  • By importing a superclass module
  • Using the extends keyword
In Python, you achieve inheritance by creating a subclass that inherits from a superclass using the syntax class Subclass(Superclass):. The extends keyword is not used for inheritance in Python.

How can you achieve multiple inheritance in Python?

  • By using interfaces.
  • By using mixins and multiple inheritance.
  • By using the extends keyword.
  • Python does not support multiple inheritance.
In Python, you can achieve multiple inheritance by using mixins. Mixins are classes that provide specific behaviors and can be combined in a class to inherit those behaviors. Python supports multiple inheritance through this mechanism.

How can you annotate a specific point on a plot in Matplotlib?

  • Add a comment with # symbol
  • Click directly on the point
  • Place a text box with plt.text()
  • Use annotate() function
To annotate a specific point on a plot in Matplotlib, you can use the plt.text() function. This function allows you to add custom text at specified coordinates on the plot, making it useful for labeling data points or adding additional information.

A ____ is a special type of binary tree where each node has a higher (or equal) value than its children.

  • AVL Tree
  • Binary Search Tree (BST)
  • B-Tree
  • Red-Black Tree
A Binary Search Tree (BST) is a special type of binary tree where each node has a higher (or equal) value than its children. This property allows for efficient searching, insertion, and deletion of elements.

A ____ is a type of binary tree where the tree automatically balances itself as items are inserted or removed.

  • AVL Tree
  • B-Tree
  • Heap
  • Red-Black Tree
A Red-Black Tree is a type of binary search tree that automatically balances itself during insertions and deletions to ensure the tree remains approximately balanced. This property ensures efficient search and insertion operations.

A ____ loop is used to iterate a block of code a specified number of times.

  • do-while
  • for
  • repeat
  • while
In Python, a for loop is commonly used to iterate over a sequence (such as a list) a specified number of times. The for loop iterates over the elements of the sequence, executing the block of code for each element.

A ____ sort is a highly efficient sorting algorithm based on partitioning of an array of data into smaller arrays.

  • Bubble
  • Merge
  • Quick
  • Selection
A Merge sort is a highly efficient sorting algorithm that uses a divide-and-conquer approach to sort an array. It repeatedly divides the array into smaller sub-arrays until each sub-array is sorted, then merges them back together to achieve the final sorted order.

A ____ tree is a tree in which each node has at most two children, which are referred to as the left child and the right child.

  • Binary
  • Octal
  • Quad
  • Ternary
A Binary Tree is a tree data structure where each node has at most two children, a left child and a right child. This data structure is commonly used in computer science and is fundamental to many algorithms and data structures.