question,option1,option2,option3,option4,answer,difficulty "What is the default port for Django development server?","8000","8080","5000","9000","8000","low" "What is a Django model?","A class that defines the structure of a database table","A view to render data to the template","A URL route handler","None of the above","A class that defines the structure of a database table","low" "Which command is used to start a Django project?","django-admin startproject","python manage.py startproject","django startproject","python startproject","django-admin startproject","low" "What is the purpose of Django’s ORM?","Handle HTTP requests","Map database tables to Python objects","Define HTML templates","Manage static files","Map database tables to Python objects","low" "What is the output of: print(2 + 3 * 4) in Django view?","14","20","16","10","14","low" "What is the Django admin?","A tool to manage database tables","A module to create URLs","A view for user authentication","A web interface for managing application data","A web interface for managing application data","low" "What is the default database engine used by Django?","SQLite","MySQL","PostgreSQL","Oracle","SQLite","low" "How do you make a model field optional in Django?","null=True","blank=True","optional=True","both null=True and blank=True","both null=True and blank=True","low" "How do you include a URL path in Django?","Include it in views.py","Use the url() function in urls.py","Use the path() function in urls.py","Both b and c","Both b and c","low" "What is the purpose of Django middleware?","Handle HTTP responses","Manage user sessions","Intercept requests and responses globally","Handle templates rendering","Intercept requests and responses globally","medium" "What is the Django context in templates?","Data passed from views to templates","HTML data in the template","URL parameters passed in request","Session data","Data passed from views to templates","medium" "Which of the following is used to display a static file in Django?","django.contrib.staticfiles","django.contrib.files","django.contrib.contenttypes","None of the above","django.contrib.staticfiles","medium" "What is the purpose of Django's 'migrations'?","To handle database changes automatically","To handle requests from the server","To perform a data transformation","To manage user permissions","To handle database changes automatically","medium" "Which function in Django is used to render a template?","render()","template()","render_template()","render_page()","render()","medium" "What is the Django settings file?","A file that contains configuration for the project","A file for database models","A file for storing views","A file to store static files","A file that contains configuration for the project","medium" "How can you limit the number of items in a queryset in Django?","Using .filter()","Using .exclude()","Using .limit()","Using .[:n]","Using .[:n]","medium" "What is the Django REST Framework?","A framework for creating RESTful APIs","A web server to handle requests","A module for managing templates","A tool for database migrations","A framework for creating RESTful APIs","medium" "How do you create a custom manager in Django?","By subclassing models.Manager","By adding methods to the model class","By using the model’s save() method","By defining custom views","By subclassing models.Manager","medium" "What is Django's 'signals' feature used for?","For sending email notifications","For triggering events between models and views","For creating scheduled tasks","For caching data","For triggering events between models and views","high" "What is the function used to run migrations in Django?","python manage.py migrate","python manage.py update","python manage.py syncdb","python manage.py makemigrations","python manage.py migrate","high" "What is the Django queryset?","An object for querying the database","A function to create URLs","A view handler","A module to generate reports","An object for querying the database","high" "How do you secure sensitive data in Django settings?","By using environment variables","By hardcoding the secrets in settings.py","By using the Django secret key generator","By using default values in settings.py","By using environment variables","high" "What is the purpose of the Django signals module?","To send and receive messages within the application","To manage database migrations","To render templates","To handle sessions in Django","To send and receive messages within the application","high" "How do you add a custom command in Django?","By defining a management command in apps.py","By creating a custom script in the root folder","By adding to the settings.py file","By subclassing Command class in a management/commands folder","By subclassing Command class in a management/commands folder","high" "How do you define a foreign key relationship in Django models?","Using ForeignKey()","Using OneToOneField()","Using ManyToManyField()","Using RelationshipField()","Using ForeignKey()","high" "What is Django’s 'get_object_or_404' used for?","To retrieve a model object or return a 404 error if not found","To check if an object exists in the database","To handle request errors in views","To redirect to a different page if an object doesn’t exist","To retrieve a model object or return a 404 error if not found","high" "What is Django’s 'csrf_token' used for?","To prevent cross-site scripting attacks","To handle form submissions safely","To manage user sessions securely","To prevent cross-site request forgery attacks","To prevent cross-site request forgery attacks","high" "How do you create a new Django app?","django-admin startapp app_name","python manage.py startapp app_name","python startapp app_name","django startapp app_name","django-admin startapp app_name","high" "What does Django’s 'context' contain?","Data passed to templates from views","User request data","Session data","Model data","Data passed to templates from views","high" "How do you define a many-to-many relationship in Django?","Using ManyToManyField()","Using ForeignKey()","Using OneToOneField()","Using ManyToManyField() in views","Using ManyToManyField()","high" "What is the Django shell used for?","Testing models and queries interactively","To run server commands","To manage static files","To manage user sessions","Testing models and queries interactively","high" "How do you add a static file in Django?","By placing it in a static folder","By using the static() function in views","By adding it to settings.py","By including a link in templates","By placing it in a static folder","high" "What is the function used to create a new Django superuser?","python manage.py createsuperuser","python manage.py superuser","python manage.py makeuser","python manage.py addsuperuser","python manage.py createsuperuser","high" "How do you declare a variable in Python?","var x = 10","int x = 10","x = 10","declare x = 10","x = 10","low" "What is the output of: print(type([]))?","list","tuple","dict","set","list","low" "What does the len() function do?","Returns length of a sequence","Returns a list","Converts string to list","Creates a dictionary","Returns length of a sequence","low" "Which of the following is a valid Python data type?","integer","float","string","All of the above","All of the above","low" "How do you declare a function in Python?","fun my_function()","def my_function()","function my_function()","None of the above","def my_function()","low" "What is the output of: print(3 * 'Python')?","PythonPythonPython","Error","Python3","None","PythonPythonPython","medium" "Which method is used to add an element to a set?","add()","append()","insert()","extend()","add()","medium" "What is the output of: print(5 // 2)?","2.5","2","3","Error","2","medium" "How do you handle exceptions in Python?","try-catch","try-finally","try-except","try-else","try-except","medium" "What is a Python decorator?","A function returning another function","A type of module","A Python class","A data structure","A function returning another function","high" "How do you define a lambda function in Python?","lambda x: x * 2","def lambda x: x * 2","lambda x => x * 2","None of the above","lambda x: x * 2","high" "What is the time complexity of accessing an element in a dictionary?","O(1)","O(n)","O(log n)","O(n^2)","O(1)","high" "How do you create a virtual environment in Python?","python3 -m venv venv","virtualenv venv","venv create venv","None of the above","python3 -m venv venv","high" "What is the output of: print('Python'[::-1])?","nohtyP","Python","Error","None","nohtyP","high" "What is the purpose of the 'continue' statement in Python?","Exits the loop","Skips the current iteration","Pauses the loop","None of the above","Skips the current iteration","high" "What does the map() function do in Python?","Applies a function to all items in an iterable","Combines two lists","Filters out elements from a list","None of the above","Applies a function to all items in an iterable","high" "How do you check if a key exists in a dictionary?","key in dict","dict.has_key(key)","key in dict.keys()","None of the above","key in dict","high" "How do you remove an item from a list by index?","list.remove(index)","list.pop(index)","del list[index]","None of the above","list.pop(index)","high" "What is the output of: print([i**2 for i in range(3)])?","[0, 1, 4]","[1, 4, 9]","[0, 2, 4]","[1, 2, 3]","[0, 1, 4]","high" "How do you round a number in Python?","round(number)","round(number, 2)","floor(number)","ceil(number)","round(number, 2)","high"