Learn Drupal MCQs

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

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

1) Modify forms

2) Create new forms

3) Delete forms

4) Display forms

Answer : Modify forms

Which command is used to run the cron jobs in Drupal using Drush?

1) drush cron

2) drush run-cron

3) drush cron-run

4) drush execute-cron

Answer : drush cron

What is the function used to display a theme in Drupal?

1) theme()

2) drupal_render()

3) theme_render()

4) render_theme()

Answer : theme()

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

1) hook_menu()

2) hook_routes()

3) routing.yml

4) hook_route()

Answer : routing.yml

What is the purpose of `hook_entity_view_alter()`?

1) To alter entity view modes

2) To create new entity views

3) To delete entity views

4) To manage permissions for entities

Answer : To alter entity view modes

What does the `hook_node_view_alter()` function do?

1) Alters node display

2) Creates nodes

3) Deletes nodes

4) Manages node permissions

Answer : Alters node display

Which command is used to clear the cache of a specific module in Drush?

1) drush cr module_name

2) drush cache-clear module_name

3) drush cc module_name

4) drush clear-cache module_name

Answer : drush cc module_name

What is the purpose of `hook_entity_view()`?

1) To control the rendering of entities

2) To create entities

3) To delete entities

4) To manage entity permissions

Answer : To control the rendering of entities

What does the `hook_preprocess_node_view()` function allow you to do?

1) Alter node view output

2) Create nodes

3) Delete nodes

4) Manage node types

Answer : Alter node view output

What does `hook_theme_suggestions_HOOK_alter()` do in Drupal?

1) Alters theme suggestions

2) Creates new theme hooks

3) Deletes theme hooks

4) Defines theme functions

Answer : Alters theme suggestions