Learn Drupal MCQs

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

Which hook is used to alter forms in Drupal?

1) hook_form_alter()

2) hook_form_modify()

3) hook_alter_form()

4) hook_alter()

Answer : hook_form_alter()

What is the command to uninstall a module in Drupal using Drush?

1) drush pm-uninstall module_name

2) drush uninstall module_name

3) drush mod-uninstall module_name

4) drush module-uninstall

Answer : drush pm-uninstall module_name

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

1) Modify existing menu items

2) Create new menu items

3) Delete menu items

4) Manage menu access

Answer : Modify existing menu items

Which file is used to define routes in a custom Drupal module?

1) module.routing.yml

2) module.route.yml

3) module.routing.yaml

4) module.routes.yaml

Answer : module.routing.yml

What is the command to export Drupal configuration using Drush?

1) drush config-export

2) drush config-ex

3) drush export-config

4) drush export

Answer : drush config-export

Which of the following is a valid Drupal template suggestion?

1) node--page.tpl.php

2) page--node.tpl.php

3) block--node.tpl.php

4) field--page.tpl.php

Answer : node--page.tpl.php

What is the function used to create a new user in Drupal?

1) user_save()

2) user_create()

3) create_user()

4) drupal_user_save()

Answer : user_save()

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

1) Alter block theme suggestions

2) Create new blocks

3) Delete block themes

4) Alter block contents

Answer : Alter block theme suggestions

What is the purpose of `hook_node_update()`?

1) Perform actions when a node is updated

2) Create nodes

3) Delete nodes

4) Manage node types

Answer : Perform actions when a node is updated

What does the `hook_help()` function provide in a Drupal module?

1) Help text for the module

2) Help text for the block

3) A help page

4) A contact form

Answer : Help text for the module