To create a new URL pattern in a Django app, you have to add it to the ____ file.

  • models.py
  • settings.py
  • urls.py
  • views.py
In Django, you create new URL patterns by adding them to the urls.py file of your app. This file maps URLs to view functions, allowing you to define the routing of your web application.

To debug Python scripts, you can use the ____ module to set breakpoints and inspect variable values.

  • debug
  • inspect
  • pdb
  • testing
In Python, the pdb module is used for debugging. It allows you to set breakpoints, step through code, and inspect variable values during program execution.

To define a generator, you use the ____ keyword in the function definition.

  • break
  • continue
  • return
  • yield
In Python, to define a generator, you use the yield keyword within a function. A generator function produces an iterator, which can be used to generate a sequence of values lazily, conserving memory and improving performance.

To define a metaclass, you generally override the _____ method to customize class creation.

  • class
  • init
  • metaclass
  • new
To define a metaclass, you generally override the __new__ method. This method is responsible for creating the class itself and can be customized to modify class attributes and behavior during creation.

To enable database migrations in Flask, the ____ extension can be used.

  • Flask-Database
  • Flask-Migrate
  • Flask-ORM
  • Flask-SQLAlchemy
To enable database migrations in Flask, the Flask-Migrate extension is used. Flask-Migrate is an extension that integrates the Alembic database migration framework with Flask applications, allowing you to manage database schema changes easily.

The ____ function in TensorFlow or PyTorch is used to compute the gradient of a computation with respect to its input variables.

  • backward
  • calculate_gradient
  • compute_gradient
  • gradient
In deep learning frameworks like TensorFlow and PyTorch, the backward function (or backward() method) is used to compute the gradient of a computation with respect to its input variables. This is crucial for gradient-based optimization algorithms like stochastic gradient descent (SGD) during training.

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.