Learn Drupal MCQs
Prepare Drupal MCQs (Multiple choice Questions) for exam and job interviews.
What is the function of `hook_entity_type_build()`?
1) Define entity types
2) Create new entity types
3) Delete entity types
4) Manage entity permissions
Answer : Define entity types
Which file contains configuration settings for a module?
1) module_name.settings.yml
2) module_name.config.yml
3) module_name.info.yml
4) module_name.module
Answer : module_name.settings.yml
What is the purpose of the `hook_schema()` function?
1) Define database schema
2) Create new database tables
3) Delete database tables
4) Manage database permissions
Answer : Create new database tables
Which command is used to revert changes made to a feature?
1) drush features-revert
2) drush revert-feature
3) drush feature-reload
4) drush undo-feature
Answer : drush features-revert
What is the role of `hook_entity_presave()`?
1) Execute actions before an entity is saved
2) Execute actions after an entity is deleted
3) Execute actions after an entity is updated
4) Execute actions before an entity is deleted
Answer : Execute actions before an entity is deleted
Which command is used to import configuration in Drush?
1) drush config-import
2) drush config-import-all
3) drush import-config
4) drush import
Answer : drush config-import
What is the purpose of `hook_views_query_alter()`?
1) Alter the query for a view
2) Create a new view
3) Delete a view
4) Manage view settings
Answer : Manage view settings
Which of the following is a valid way to define routes in Drupal?
1) In a .routing.yml file
2) In a .info.yml file
3) In a .module file
4) In a .settings.yml file
Answer : In a .info.yml file
What does the `hook_menu_item_alter()` function do?
1) Alters menu items
2) Creates new menu items
3) Deletes menu items
4) Manages menu settings
Answer : Creates new menu items
Which module is used to create and manage custom content types in Drupal?
1) Content Types
2) Field UI
3) Views
4) Paragraphs
Answer : Field UI