Flask Multiple-Choice Questions (MCQs)

Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries.

Flask MCQs: This section contains multiple-choice questions and answers on the various topics of Flask. Practice these MCQs to test and enhance your skills on Flask.

List of Flask MCQs

1. Flask framework is written in which of the following language?

  1. Java
  2. Python
  3. JavaScript

Answer: B) Python

Explanation:

The flask framework is written in python language.

Discuss this Question


2. Is Flask an open-source framework?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Flask framework is open-source.

Discuss this Question


3. Who developed the flask?

  1. Guido van Rossum
  2. Armin Ronacher
  3. James Gosling

Answer: B) Armin Ronacher

Explanation:

Armin Ronacher developed Flask.

Discuss this Question


4. Which is better Flask and Django?

  1. Flask
  2. Django

Answer: A) Flask

Explanation:

API support is provided by Flask; however, API support is not provided by Django.

Discuss this Question


5. By default, the flask server is ____?

  1. User-level thread
  2. Single-threaded
  3. multi-threaded

Answer: C) multi-threaded

Explanation:

By default, the flask server is multi-threaded.

Discuss this Question


Advertisement

6. Flask is reliant on which of the following?

  1. Jinja template
  2. Werkzeug WSGI framework
  3. Only A
  4. Only B
  5. Both A and B
  6. JavaScript

Answer: E) Both A and B

Explanation:

Flask is reliant on the Jinja template engine as well as the Werkzeug WSGI framework.

Discuss this Question


7. ____ is a framework for writing command line applications?

  1. MarkupSafe
  2. Jinja
  3. Click

Answer: C) Click

Explanation:

Click is a framework for writing command-line applications.

Discuss this Question


8. Which of the following dependency makes the development server's reloader quicker and more efficient in Flask?

  1. Blinker
  2. Watchdog
  3. Jinja

Answer: B) Watchdog

Explanation:

Watchdog makes the development server's reloader quicker and more efficient.

Discuss this Question


9. Flask is a framework for ____?

  1. Web development
  2. Mobile development
  3. Database development
  4. Cloud development

Answer: A) Web development

Explanation:

Flask framework is for web development.

Discuss this Question


10. What is WSGI in Flask?

  1. Wide system gateway interface
  2. Wide server gateway interface
  3. Web system gateway interface
  4. Web server gateway interface

Answer: D) Web server gateway interface

Explanation:

WSGI stands for Web server gateway interface

Discuss this Question


Advertisement

11. Which architecture does Flask follows?

  1. MVC
  2. MVP
  3. MVVM

Answer: A) MVC

Explanation:

Flask Framework follows MVC architecture.

Discuss this Question


12. Does the flask have a built in abstraction layer?

  1. Yes
  2. No

Answer: B) NO

Explanation:

Because Flask is a Micro Framework, it lacks a database abstraction layer.

Discuss this Question


13. ____ is a virtual Python environment builder?

  1. venv
  2. env
  3. virtualenv

Answer: C) virtualenv

Explanation:

virtualenv is a virtual Python environment builder.

Discuss this Question


14. The Flask class's ____function is a decorator that instructs the application which URL should call the related function?

  1. Route()
  2. Api()
  3. Name()

Answer: A) Route()

Explanation:

The Flask class's route() function is a decorator that instructs the application which URL should call the related function.

Discuss this Question


15. To run the application in Flask which of the following command is used?

  1. Run flask
  2. Run—flask
  3. Flask
  4. Start-pythonflask

Answer: C) Flask

Explanation:

To launch the application, use the flask command or python -m flask.

Discuss this Question


Advertisement

16. What is the default port for Flask?

  1. 8000
  2. 8080
  3. 3000
  4. 5000

Answer: D) 5000

Explanation:

The default port of Flask is 5000.

Discuss this Question


17. How do you start the development server in flask?

  1. Flask run
  2. RunFlask
  3. Run—
  4. FlaskRun--

Answer: A) Flask run

Explanation:

The flask run command starts the development server in the flask.

Discuss this Question


18. The project's endpoint's canonical URL has a ____ slash?

  1. Trailing
  2. Backward

Answer: A) Trailing

Explanation:

The project's endpoint's canonical URL has a trailing slash.

Discuss this Question


19. The ____method is quite handy for creating a URL for a given function dynamically?

  1. URL()
  2. Make_url()
  3. url_for()
  4. Create_url()

Answer: C) url_for()

Explanation:

The url_for() method is quite handy for creating a URL for a given function dynamically.

Discuss this Question


20. Which of the following method sends HTML form data to the server?

  1. Get
  2. Head
  3. Post
  4. Put
  5. Delete

Answer: C) Post

Explanation:

The post method sends HTML form data to the server.

Discuss this Question


Advertisement

21. Which of the following method replaces the submitted content with all current representations of the target resource?

  1. Get
  2. Head
  3. Post
  4. Put
  5. Delete

Answer: D) Put

Explanation:

The put method replaces the submitted content with all current representations of the target resource.

Discuss this Question


22. Which of the following method removes all existing representations of the resource specified by a URL?

  1. Remove
  2. Del
  3. Eliminate
  4. Delete

Answer: D) Delete

Explanation:

The delete method removes all existing representations of the resource specified by a URL.

Discuss this Question


23. Which of the following is the most often used approach and sends data to the server in an unencrypted format?

  1. Get
  2. Head
  3. Post
  4. Put
  5. Delete

Answer: A) Get

Explanation:

Get method is the most often used approach and sends data to the server in an unencrypted format.

Discuss this Question


24. Which of the following method is the same as the GET method but it does not have any response body?

  1. Get
  2. Head
  3. Post
  4. Put
  5. Delete

Answer: B) Head

Explanation:

The head method is the same as the GET method but it does not have any response body.

Discuss this Question


25. All the CSS and JavaScript files are stored in which of the following folder?

  1. Static
  2. Component
  3. Root
  4. Config

Answer: A) Static

Explanation:

Static folder contains CSS and JavaScript files.

Discuss this Question


26. Which of the following method is used to render a template?

  1. Render
  2. Template_render()
  3. Template
  4. Render_template()

Answer: D) Render_template()

Explanation:

To render a template you can use the render_template() method.

Discuss this Question


27. Flask will look in the ____folder for templates?

  1. Static
  2. Application
  3. Template

Answer: C) Template

Explanation:

Flask will look in the templates folder for templates.

Discuss this Question


28. To render the contents of a block defined in the parent template, which of the following function is used?

  1. {{ super() }}
  2. {{ parent }}
  3. Super {}
  4. {Body()}

Answer: A) {{ super() }}

Explanation:

To render the contents of a block defined in the parent template, use {{ super() }}.

Discuss this Question


29. The conditional statements if-else and endif are enclosed in delimiter ____?

  1. [%..%]
  2. (%..%)
  3. {%..%}

Answer: C) {%..%}

Explanation:

The conditional statements if-else and endif are enclosed in delimiter {%..%}.

Discuss this Question


30. Is it necessary to include enctype="multipart/form-data" in your form every time to upload files?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

enctype="multipart/form-data" is important otherwise the browser will not transmit your files at all.

Discuss this Question


Advertisement

31. Which of the following attribute is used to gain access to cookies?

  1. Set
  2. Cookies
  3. Set_cookies

Answer: B) Cookies

Explanation:

The cookies attribute can be used to gain access to cookies.

Discuss this Question


32. Flask extensions are usually named ____?

  1. Flask-Foo
  2. Flask extension
  3. Flask

Answer: A) Flask-Foo

Explanation:

Flask extensions are usually named "Flask-Foo" or "Foo-Flask".

Discuss this Question


33. We Use the ____function to display a message?

  1. Display()
  2. Show()
  3. Flash()
  4. Message()

Answer: C) Flash()

Explanation:

We use the flash() function to display a message.

Discuss this Question


34. A common response format when writing an API is ____?

  1. JSON
  2. XML
  3. HTML

Answer: A) JSON

Explanation:

A common response format when writing an API is JSON.

Discuss this Question


35. Error code 429 is for ____.

  1. for Not Found
  2. for Unauthenticated
  3. Too Many Requests

Answer: C) Too Many Requests

Explanation:

Error code 429 means Too Many Requests.

Discuss this Question


36. We use the ____method to cancel a request with an error code?

  1. Cancel()
  2. Abort()
  3. Remove()

Answer: B) Abort()

Explanation:

We use the abort method to cancel a request with an error code.

Discuss this Question


37. Which of the following method is used to send a user to another endpoint?

  1. Direct()
  2. url()
  3. redirect()
  4. Page()

Answer: C) redirect()

Explanation:

Redirect() method to send a user to another endpoint.

Discuss this Question


38. To release a session variable which of the following method is used?

  1. Pop()
  2. Release()
  3. Post()
  4. Del()

Answer: A) Pop()

Explanation:

To release a session variable pop() method is used.

Discuss this Question


39. A ____is issued to each client session?

  1. Cookies
  2. Object
  3. Class
  4. Session ID

Answer: D) Session ID

Explanation:

A Session ID is issued to each client session.

Discuss this Question


40. A ____is the time interval between when a client logs into and logs off of a server?

  1. Cookies
  2. Assembly time
  3. Session
  4. Run

Answer: C) Session

Explanation:

A session is the time interval between when a client logs into and logs off of a server.

Discuss this Question


41. Session data is stored on ____?

  1. Server
  2. Client

Answer: B) Client

Explanation:

Session data is stored on the client.

Discuss this Question


42. Which of the following method of request.cookies attribute is used to read a cookie?

  1. Get
  2. Post
  3. Put

Answer: A) Get

Explanation:

The get() method of request.cookies attribute is used to read a cookie.

Discuss this Question


43. Which of the following extension sends mail to the users/clients?

  1. Mail
  2. Flask mail
  3. Mailtower

Answer: B) Flask mail

Explanation:

Flask mail extension sends mail to the users/clients.

Discuss this Question


44. Which of the following adds an attachment to a message?

  1. Add()
  2. Add_attachment()
  3. Addon()
  4. Attach()

Answer: D) Attach()

Explanation:

Attach() adds an attachment to the message.

Discuss this Question


45. We may specify the form fields in our Python script and present them using an HTML template using ____?

  1. Flask-form
  2. Flask-WTF
  3. Flask__forms

Answer: B) Flask-WTF

Explanation:

We may specify the form fields in our Python script and present them using an HTML template using Flask-WTF.

Discuss this Question


46. What Flask extension may be used to build an Ajax application?

  1. Flask Sijax
  2. Flask-WTF
  3. Flask-Ax

Answer: A) Flask Sijax

Explanation:

Flask Sijax extension may be used to build an Ajax application.

Discuss this Question


47. Sijax stands for ____.

  1. System Ajax
  2. Server Ajax
  3. Simple Ajax

Answer: C) Simple Ajax

Explanation:

Sijax stands for simple Ajax.

Discuss this Question


48. Which of the following extension create an Admin interface in Flask?

  1. Admin
  2. Flask-admin
  3. AdminFlask

Answer: B) Flask-admin

Explanation:

The flask-admin extension creates an Admin interface in Flask.

Discuss this Question


49. Sijax uses ____to pass the data between the browser and the server?

  1. Object
  2. XML
  3. HTML
  4. JSON

Answer: D) JSON

Explanation:

Sijax uses JSON to pass the data between the browser and the server.

Discuss this Question


50. Which of the following returns one row from the query?

  1. One()
  2. Fetchone()
  3. Fetchonly()

Answer: B) Fetchone()

Explanation:

fetchone() returns one row from the query.

Discuss this Question


51. session is a ____that stores data across requests?

  1. Dict
  2. Hash
  3. List

Answer: A) Dict

Explanation:

Session is a dict that stores data across requests.

Discuss this Question


52. ____ is another deployment option for Flask application on web servers like nginix, lighttpd, and Cherokee?

  1. Flask-WSGI
  2. Flask
  3. FastCGI

Answer: C) FastCGI

Explanation:

FastCGI is another deployment option for Flask applications on web servers like nginix, lighttpd, and Cherokee.

Discuss this Question


53. What is g in Flask?

  1. A global namespace for holding any data
  2. A local namespace for holding any data

Answer: A) A global namespace for holding any data

Explanation:

g in Flask is a global namespace for holding any data.

Discuss this Question


54. How do you obtain the HTTP headers in Flask?

  1. Headers
  2. Http.head
  3. Flask.request.head
  4. flask.request.headers

Answer: D) flask.request.headers

Explanation:

flask.request.headers helps us to obtain the HTTP headers in Flask.

Discuss this Question


55. How many types of data does a template have?

  1. 3
  2. 4
  3. 5
  4. 2

Answer: D) 2

Explanation:

The template contains two types of data: Static and dynamic.

Discuss this Question


56. A ____is a function that extends the functionality of another function without modifying it?

  1. Unit
  2. Module
  3. Decorator
  4. Component

Answer: C) Decorator

Explanation:

A decorator is a function that extends the functionality of another function without modifying it.

Discuss this Question


57. In Flask, how do you return JSON??

  1. Jason()
  2. Jasonify()
  3. Jason_object()
  4. Jason.flask

Answer: B) Jasonify()

Explanation:

Jasonify() function returns JSON.

Discuss this Question


58. Which of the following is a micro framework?

  1. Django
  2. Pyramid
  3. Flask

Answer: C) Flask

Explanation:

Flask is a micro framework.

Discuss this Question


59. How many ways are provided by flask to establish the database connection?

  1. 3
  2. 4
  3. 5
  4. 2

Answer: A) 3

Explanation:

Three ways are provided by flask to establish the database connection:

  • Before_request()
  • After_request()
  • Teardown_ request()

Discuss this Question


60. Which of the following is the correct extension of Flask?

  1. .Flask
  2. .py
  3. .python
  4. .flask_python

Answer: B) .py

Explanation:

.py is the correct extension of the flask.

Discuss this Question


ADVERTISEMENT
ADVERTISEMENT


What's New (MCQs)



Comments and Discussions!




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.