Which Python module would you use for logging error and debugging messages?

  • debug
  • logging
  • sys
  • trace
The logging module is commonly used for logging error and debugging messages in Python. It provides a flexible and configurable way to manage logs in your applications.

Which Python module provides a set of tools for constructing and running scripts to test the individual units of your code?

  • assert
  • debugger
  • sys
  • unittest
The unittest module in Python provides a framework for writing and running unit tests. It allows you to create test cases and test suites to verify the correctness of your code's individual units or functions.

Which Python module provides a set of functions to help with debugging and interactive development?

  • debug
  • debugutil
  • inspect
  • pdb
The Python module pdb (Python Debugger) provides a set of functions for debugging and interactive development. It allows you to set breakpoints, step through code, inspect variables, and more.

Which Python module is commonly used for writing unit tests?

  • debugger
  • logging
  • pytest
  • unittest
The unittest module is commonly used in Python for writing unit tests. It provides a testing framework to create and run test cases and manage test suites. While pytest is another popular testing framework, it's not a module but an external library. debugger and logging are unrelated to writing unit tests.

Which Python library would you use to perform elementary matrix operations and computations?

  • Matplotlib
  • NumPy
  • Pandas
  • TensorFlow
You would use the NumPy library for elementary matrix operations and computations. NumPy provides a powerful array object and functions to manipulate arrays efficiently.

Which Python library would you use for implementing machine learning algorithms and is known for its simplicity and efficiency?

  • Matplotlib
  • Numpy
  • Pandas
  • Scikit-learn
Scikit-learn (or sklearn) is a widely-used Python library for machine learning. It provides a simple and efficient way to implement various machine learning algorithms, making it a popular choice among data scientists and developers.

Which Python library is specifically designed for creating static, interactive, and real-time graphs and plots?

  • Matplotlib
  • NumPy
  • Pandas
  • Seaborn
Matplotlib is specifically designed for creating static, interactive, and real-time graphs and plots in Python. It is a widely-used plotting library for data visualization.

Which Python keyword is used to define a base class?

  • class
  • inherit
  • parent
  • superclass
In Python, the class keyword is used to define a class, including a base class (parent class). You create a base class by defining a class using the class keyword.

Which Python keyword is primarily used in generator functions to yield values?

  • break
  • continue
  • return
  • yield
The yield keyword is used in generator functions to yield values one at a time. It allows the function to pause its execution state and resume it when the next value is requested, making generators memory-efficient and suitable for iterating over large datasets.

Which Python framework allows you to integrate Python back-end code with HTML, CSS, and JavaScript for web development?

  • Bottle
  • Django
  • Flask
  • Pyramid
Flask is a micro web framework for Python that allows you to integrate Python back-end code with HTML, CSS, and JavaScript to build web applications. Django, Pyramid, and Bottle are also Python web frameworks, but Flask is known for its simplicity and flexibility, making it suitable for beginners.

Which Python feature would you use to modify the behavior of a function or method?

  • Decorators
  • Encapsulation
  • Inheritance
  • Polymorphism
In Python, decorators are used to modify the behavior of functions or methods. They allow you to add functionality to existing code without modifying its structure. Decorators are often used for tasks like logging, authentication, and more.

Which Python entity is primarily affected or modified by a metaclass?

  • Classes
  • Functions
  • Modules
  • Variables
Metaclasses primarily affect or modify classes. They define how classes themselves are created and behave, allowing you to add, modify, or replace class attributes and methods.