JustPaste.it

Flask Interview Questions - TAE

Flask is written in Python, it is a micro web framework. It is based on the Werkzeug toolkit and Jinja 2 template engine.

Top 10 Flask Interview Questions

1) What is Flask?

Flask is written in Python, it is a micro web framework. It is based on the Werkzeug toolkit and Jinja 2 template engine.

2) Who is the developer of Flask?

The developer of Flask is Armin Ronacher.

3) What is the stable version of Flask?

The stable version of Flask is 0.12.2 and was released on 16 May 2017.

4) What are Flask-WTF and its features?

Flask-WTF and its features are below:

  • It provides integration with WTF
  • It manages a secure form with a CSRF token
  • It manages global CSRF protection
  • It provides Internationalization integration
  • It supports Recaptcha
  • It handles the file upload that works with Flask uploads

5) What is the benefit of a flask?

Flask is a part of the micro-framework. It does not require external libraries. It makes the framework lightweight, less dependent, and less security bugs.

6) How can we access sessions in Flask?

In Flask, a session allows us to remember information from one request to another. It uses a signed cookie so the user can look at the session contents. We can access the session by using the secret key Flask.secret_key in the Flask framework.

7) How can we request database connections in Flask?

Flask provides three ways to establish a database connection. These are given below.

  1. before_request(): It is called before a request and requires no arguments.
  2. after_request(): It is called after a request and passes the response sent to the client
  3. teardown_request(): It is used when an exception is raised and responses are not guaranteed. It is called after the response and cannot modify the request or its values.

8) What is the appropriate way to work with Flask script?

The appropriate way to work with flask script includes the following steps:

  • Either it should be the import path for our application
  • Or the path to a Python file

9) What is Flask Sijax?

Flask Sijax is a Simple Ajax & jQuery library. It is used to enable Ajax in web applications. It uses JSON to pass data between the server and the browser.

10) How can we get a query string from the Flask?

Using the following function, we can get a query string from the flask.

  1. @app.route('/data')
  2.     def data ( ) :
  3.     user = request.arg.get ('user')

Top 31 Flask Interview Questions