Learn Drupal MCQs

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

What does `hook_entity_type_insert()` do?

1) Execute actions when an entity type is created

2) Execute actions when an entity type is updated

3) Execute actions when an entity type is deleted

4) Manage entity type permissions

Answer : Manage entity type permissions

What is the function of `drupal_get_path()`?

1) Get the path of a module

2) Get the URL of a page

3) Get the path of a theme

4) Get the path of a file

Answer : Get the URL of a page

What does the `hook_field_widget_info()` function do?

1) Defines field widgets

2) Creates new fields

3) Deletes fields

4) Manages field settings

Answer : Manages field settings

Which file is essential for defining a custom module in Drupal?

1) module_name.info.yml

2) module_name.module

3) module_name.routing.yml

4) module_name.install

Answer : module_name.info.yml

What is the purpose of `hook_theme_suggestions_HOOK()`?

1) Add theme suggestions

2) Create new themes

3) Delete themes

4) Manage theme settings

Answer : Manage theme settings

What does `drupal_set_message()` do?

1) Displays a message to the user

2) Creates a new message type

3) Deletes messages

4) Manages message settings

Answer : Creates a new message type

What is the role of `hook_form_FORM_ID_alter()`?

1) Modify a specific form

2) Create a new form

3) Delete a form

4) Manage form permissions

Answer : Create a new form

Which command is used to list all available Drush commands?

1) drush list

2) drush commands

3) drush help

4) drush show-commands

Answer : drush list

What is the purpose of `hook_menu_local_tasks_alter()`?

1) Alter local tasks

2) Create new menu items

3) Delete menu items

4) Manage menu settings

Answer : Manage menu settings

What does `hook_entity_update()` do?

1) Execute actions when an entity is updated

2) Execute actions when an entity is created

3) Execute actions when an entity is deleted

4) Manage entity permissions

Answer : Execute actions when an entity is created