- Which library is a micro web framework in Python?
View Answer
Correct answer: A — Flask
- What will be printed?
1 python 2 from flask import Flask 3 app = Flask(__name__) 4 print(app.name) View Answer
Correct answer: A — main
- Which decorator is used to define a route in Flask?
View Answer
Correct answer: A — @app.route()
- What is the output of below code?
1 python 2 @app.route("/") 3 def home(): 4 return "Eduinq" 5 (Accessing "/") View Answer
Correct answer: A — Eduinq
- Which method runs Flask app?
View Answer
Correct answer: A — app.run()
- What will be printed?
1 python 2 from flask import Flask 3 app = Flask(__name__) 4 print(hasattr(app,"run")) View Answer
Correct answer: A — True
- Which of the following is used for templates in Flask?
View Answer
Correct answer: A — Jinja2
- What is the output of below code?
1 python 2 from flask import render_template_string 3 print(render_template_string("Hello {{name}}",name="Eduinq")) View Answer
Correct answer: A — Hello Eduinq
- Which of the following is used for request data in Flask?
View Answer
Correct answer: D — All of the above
- What will be printed?
1 python 2 from flask import request 3 print(hasattr(request,"form")) View Answer
Correct answer: A — True
- Which of the following is a full stack web framework in Python?
View Answer
Correct answer: A — Django
- What is the output of below code?
1 python 2 import django 3 print(django.get_version()) View Answer
Correct answer: A — Django version string
- Which command creates a new Django project?
View Answer
Correct answer: A — django-admin startproject
- What will be printed?
1 bash 2 django-admin startproject Eduinq View Answer
Correct answer: A — Creates project Eduinq
- Which command creates a new Django app?
View Answer
Correct answer: A — python manage.py startapp
- What is the output of python manage.py startapp blog?
View Answer
Correct answer: A — Creates app blog
- Which file contains Django project settings?
View Answer
Correct answer: A — settings.py
- What will be printed?
1 python 2 from django.conf import settings 3 print(hasattr(settings,"INSTALLED_APPS")) View Answer
Correct answer: A — True
- Which file contains URL routing in Django?
View Answer
Correct answer: A — urls.py
- What is the output of below code?
1 python 2 from django.urls import path 3 print(callable(path)) View Answer
Correct answer: A — True
- Which file defines models in Django?
View Answer
Correct answer: A — models.py
- What will be printed?
1 python 2 from django.db import models 3 print(hasattr(models,"Model")) View Answer
Correct answer: A — True
- Which file defines views in Django?
View Answer
Correct answer: A — views.py
- What is the output of below code?
1 python 2 from django.http import HttpResponse 3 def home(request): 4 return HttpResponse("Eduinq") 5 (Accessing home view) View Answer
Correct answer: A — Eduinq
- Which file defines URL patterns in Django?
View Answer
Correct answer: A — urls.py
- What will be printed?
1 python 2 from django.urls import path 3 print(callable(path)) View Answer
Correct answer: A — True
- Which of the following is Django's ORM feature?
View Answer
Correct answer: A — QuerySets
- What is the output of below code?
1 python 2 from django.db import models 3 print(issubclass(models.Model,object)) View Answer
Correct answer: A — True
- Which command runs Django development server?
View Answer
Correct answer: A — python manage.py runserver
- What will be printed?
1 bash 2 python manage.py runserver View Answer
Correct answer: A — Starts server
- Which of the following is Flask's default server?
View Answer
Correct answer: A — Werkzeug
- What is the output of below code?
1 python 2 from flask import Flask 3 app = Flask(__name__) 4 print(app.static_url_path) View Answer
Correct answer: A — /static
- Which of the following is Django's template language?
View Answer
Correct answer: A — Django Template Language (DTL)
- What will be printed?
1 html 2 {{ "Eduinq"|upper }} View Answer
Correct answer: A — EDUINQ
- Which of the following is Flask's default template engine?
View Answer
Correct answer: A — Jinja2
- What is the output of below code?
1 python 2 from flask import render_template_string 3 print(render_template_string("{{'Eduinq'|lower}}")) View Answer
Correct answer: A — eduinq
- Which of the following is used for database migrations in Django?
View Answer
Correct answer: C — Both A and B
- What will be printed?
1 bash 2 python manage.py makemigrations View Answer
Correct answer: A — Creates migration files
- Which of the following is used for Django admin interface?
View Answer
Correct answer: A — admin.site.register()
- What is the output of below code?
1 python 2 from django.contrib import admin 3 print(hasattr(admin.site,"register")) View Answer
Correct answer: A — True
- Which of the following is Flask's extension for database?
View Answer
Correct answer: A — Flask-SQLAlchemy
- What will be printed?
1 python 2 from flask_sqlalchemy import SQLAlchemy 3 print(callable(SQLAlchemy)) View Answer
Correct answer: A — True
- Which of the following is Django's default database?
View Answer
Correct answer: A — SQLite
- What is the output of below code?
1 python 2 from django.conf import settings 3 print(settings.DATABASES['default']['ENGINE']) View Answer
Correct answer: A — django.db.backends.sqlite3
- Which of the following is used for Flask REST API?
View Answer
Correct answer: A — Flask-RESTful
- What will be printed?
1 python 2 from flask_restful import Resource 3 print(issubclass(Resource,object)) View Answer
Correct answer: A — True
- Which of the following is used for Django REST API?
View Answer
Correct answer: A — Django REST framework
- What is the output of below code?
1 python 2 import rest_framework 3 print(hasattr(rest_framework,"serializers")) View Answer
Correct answer: A — True
- Which of the following is used for Flask sessions?
View Answer
Correct answer: A — flask.session
- What will be printed?
1 python 2 from flask import Flask,session 3 app = Flask(__name__) 4 app.secret_key="Eduinq" 5 with app.test_request_context(): 6 session["user"]="Eduinq" 7 print(session["user"]) View Answer
Correct answer: A — Eduinq