Online Exam Quiz

questionQuestion  1 to 30

Which of the following is a valid Django template tag for a for loop?

  • {% loop item in items %}
  • {% for item in items %}
  • {% iterate item in items %}
  • {% each item in items %}
Mark for review

What is the purpose of Django's request.method attribute?

  • To check the HTTP method of the request
  • To check the HTTP status of the request
  • To check the HTTP headers of the request
  • To check the HTTP body of the request
Mark for review

Which of the following is a valid HTTP status code?

  • 200
  • 700
  • 800
  • 900
Mark for review

What is Django?

  • A Python library
  • A Python framework
  • A Python interpreter
  • A Python IDE
Mark for review

How do you access form data in Django views?

  • Using request.POST
  • Using request.GET
  • Using request.FORM
  • Using request.DATA
Mark for review

Which function is used to render a template in Django?

  • render_to_template
  • render
  • render_template
  • template_render
Mark for review

Which command is used to collect static files in Django?

  • python manage.py collectstatic
  • python manage.py gatherstatic
  • python manage.py staticcollect
  • python manage.py gatherfiles
Mark for review

What is the purpose of Django's request.GET attribute?

  • To access query parameters
  • To access form data
  • To access uploaded files
  • To access session data
Mark for review

What does the 404 HTTP status code signify?

  • OK
  • Not Found
  • Forbidden
  • Bad Request
Mark for review

Which command is used to create a new Django application?

  • django-admin createapp
  • django createapp
  • django-admin startapp
  • django startapp
Mark for review

Which of the following is a valid field type in Django models?

  • TextField
  • StringField
  • CharacterField
  • CharField
Mark for review

Which file is used to configure URLs in a Django project?

  • settings.py
  • urls.py
  • models.py
  • views.py
Mark for review

Which middleware class is used to enable sessions in Django?

  • SessionMiddleware
  • CacheMiddleware
  • CommonMiddleware
  • SecurityMiddleware
Mark for review

Which of the following is a valid Django model field option?

  • max_length
  • min_length
  • max_value
  • min_value
Mark for review

What is the purpose of Django's STATIC_URL setting?

  • To define the URL for static files
  • To define the URL for media files
  • To define the URL for templates
  • To define the URL for admin files
Mark for review

Which command is used to run Django's development server?

  • python manage.py runserver
  • python manage.py startserver
  • python manage.py devserver
  • python manage.py server
Mark for review

Which of the following is a valid Django model field type for a date?

  • DateField
  • TimeField
  • DateTimeField
  • All of the above
Mark for review

Which command is used to create a Django superuser?

  • python manage.py createsuperuser
  • python manage.py createsuper
  • python manage.py superuser
  • python manage.py createadmin
Mark for review

How do you define a model in Django?

  • Using a class that inherits from models.Model
  • Using a function that returns a dictionary
  • Using a list of tuples
  • Using a dictionary
Mark for review

What is the purpose of Django's settings.py file?

  • To define the URL patterns
  • To define the models
  • To configure the application settings
  • To define the views
Mark for review

What is the purpose of Django's HttpResponse class?

  • To handle HTTP requests
  • To create an HTTP response
  • To define the URL patterns
  • To configure the application settings
Mark for review

What is the default primary key field type in Django models?

  • IntegerField
  • CharField
  • AutoField
  • BigAutoField
Mark for review

What is the default port for Django's development server?

  • 8000
  • 8080
  • 5000
  • 3000
Mark for review

What is the purpose of the manage.py file in Django?

  • To manage database migrations
  • To manage project settings
  • To manage project applications
  • To manage all administrative tasks
Mark for review

What is the use of the migrate command in Django?

  • To create a new database
  • To create new models
  • To apply and synchronize database migrations
  • To rollback database changes
Mark for review

What is the purpose of Django's models.py file?

  • To define the URL patterns
  • To configure the application settings
  • To define database models
  • To handle HTTP requests
Mark for review

Which of the following is a valid Django model manager method?

  • all()
  • get()
  • filter()
  • All of the above
Mark for review

Which of the following is a valid Django management command?

  • python manage.py runserver
  • python manage.py startserver
  • python manage.py devserver
  • python manage.py server
Mark for review

What is the purpose of Django's get_object_or_404 function?

  • To get an object from the database or return a 404 error
  • To get a form from the database
  • To get a view from the database
  • To get a URL from the database
Mark for review

What is the purpose of Django's request.FILES attribute?

  • To access uploaded files
  • To access form data
  • To access query parameters
  • To access session data
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review