Which Python tool would you use to visualize an application’s call stack and identify performance bottlenecks?

  • cProfile
  • Gunicorn
  • Pyflame
  • Pygraphviz
Pyflame is a tool for profiling Python applications. It helps visualize the call stack and identify performance bottlenecks. cProfile (Option 1) is a built-in profiler, but it doesn't offer visualization. Gunicorn (Option 3) is a web server. Pygraphviz (Option 4) is for graph visualization, not profiling.

Which Python web framework uses the “Don’t repeat yourself” principle?

  • Django
  • Flask
  • Pyramid
  • Tornado
Django is a Python web framework that follows the "Don't repeat yourself" (DRY) principle. DRY encourages developers to avoid duplicating code by providing reusable components and an organized structure.

Which Seaborn function would you use to visualize a bivariate distribution of two variables?

  • sns.barplot()
  • sns.distplot()
  • sns.jointplot()
  • sns.plot()
To visualize a bivariate distribution of two variables in Seaborn, you should use the sns.jointplot() function. It creates a scatter plot with marginal histograms and can also display a regression line or a kernel density estimate.

Which sorting algorithm is best suited for large datasets?

  • Bubble Sort
  • Insertion Sort
  • Quick Sort
  • Selection Sort
Quick Sort is typically the best choice for sorting large datasets due to its average-case time complexity of O(n log n). Bubble Sort, Insertion Sort, and Selection Sort have worse time complexities and are less efficient for large datasets.

Which status code indicates that a request was successful in HTTP?

  • 200 OK
  • 401 Unauthorized
  • 404 Not Found
  • 500 Internal Server Error
The HTTP status code 200 OK indicates that a request was successful. It is used to signal that the request has been successfully received, understood, and accepted by the server. Other codes (404, 500, 401) indicate various error conditions.

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 Matplotlib function allows plotting data points in the form of a two-dimensional density plot?

  • contour()
  • heatmap()
  • hist2d()
  • scatter()
The heatmap() function in Matplotlib allows you to create a two-dimensional density plot. It is useful for visualizing the distribution and density of data points in a heatmap-like format.

Which method can be used to get the value for a given key from a dictionary, and if the key is not found, it returns a default value?

  • fetch()
  • get()
  • retrieve()
  • value()
The get() method of a dictionary allows you to retrieve the value associated with a given key. If the key is not found, it returns a default value, which can be specified as a second argument to get(). This is a useful way to avoid KeyError exceptions. The other options are not valid methods for this purpose.