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.

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 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 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 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 Flask function is used to start the development server of a Flask application?

  • begin()
  • launch()
  • run()
  • start()
The correct function to start the development server in Flask is run(). This function is typically called at the end of a Flask script to launch the server and make the web application accessible.

Which function in Matplotlib is primarily used to create bar plots?

  • plt.bar()
  • plt.hist()
  • plt.plot()
  • plt.scatter()
In Matplotlib, the plt.bar() function is primarily used to create bar plots. Bar plots are used to represent categorical data with rectangular bars, making it easy to compare different categories.

Which HTTP method is commonly used to read or retrieve data in a RESTful API?

  • DELETE
  • GET
  • POST
  • PUT
The HTTP method commonly used to read or retrieve data in a RESTful API is GET. It is used to fetch information from a specified resource. Other methods (POST, PUT, DELETE) are typically used for creating, updating, and deleting resources.

Which keyword is used to create a class in Python?

  • class
  • cls
  • def
  • object
In Python, the keyword used to create a class is class. Classes are used to define new data types and their behaviors.

Which keyword is used to import a module in Python?

  • import
  • include
  • module
  • require
In Python, you use the import keyword to import modules. Modules are Python files containing reusable code and data.