Learn Drupal MCQs

Prepare Drupal MCQs (Multiple choice Questions) for exam and job interviews.

What is the purpose of `hook_permission()`?

1) Define custom permissions for a module

2) Create new roles

3) Manage user permissions

4) Alter existing permissions

Answer : Manage user permissions

Which command is used to generate a module in Drupal?

1) drush generate-module

2) drush generate

3) drush create-module

4) drush make-module

Answer : drush generate-module

What is the function of `drupal_http_request()`?

1) Make HTTP requests

2) Handle form submissions

3) Store data

4) Retrieve configuration

Answer : Handle form submissions

What is the role of the `settings.php` file in Drupal?

1) Store configuration settings

2) Define routes

3) Manage user roles

4) Handle caching

Answer : Define routes

What is the purpose of the `hook_views_pre_render()` function?

1) Alter the view before rendering

2) Create new views

3) Delete views

4) Manage view permissions

Answer : Create new views

Which of the following is used to define custom routes in Drupal 8?

1) module.routing.yml

2) routes.yaml

3) module.routes.yml

4) routing.yml

Answer : routes.yaml

What does `hook_entity_type_alter()` allow you to do?

1) Alter entity types

2) Create new entity types

3) Delete entity types

4) Manage entity permissions

Answer : Manage entity permissions

What is the function of `drupal_mail()`?

1) Send email from the site

2) Store email templates

3) Delete emails

4) Retrieve email settings

Answer : Delete emails

Which command is used to update the database schema in Drush?

1) drush updatedb

2) drush db-update

3) drush run-updates

4) drush update-database

Answer : drush db-update

What is a hook in Drupal?

1) A way to alter or add functionality

2) A type of content

3) A user role

4) A module

Answer : A type of content