Learn Drupal MCQs

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

What does the `hook_views_post_execute()` function do?

1) Runs after a view is executed

2) Runs before a view is executed

3) Alters the view

4) Creates a new view

Answer : Alters the view

What is the function of the `drupal_path_alias()` function?

1) Get the alias for a given path

2) Create new path aliases

3) Delete path aliases

4) Manage path settings

Answer : Get the alias for a given path

Which command is used to clear the cache in Drush?

1) drush cr

2) drush cache-clear

3) drush clear-cache

4) drush cache-rebuild

Answer : drush cache-clear

What is the purpose of `hook_entity_presave()`?

1) Modify an entity before it is saved

2) Create new entities

3) Delete entities

4) Manage entity permissions

Answer : Modify an entity before it is saved

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