Learn Drupal MCQs
Prepare Drupal MCQs (Multiple choice Questions) for exam and job interviews.
What does the `hook_block_view_alter()` function do?
1) Alters the block view output
2) Creates new blocks
3) Deletes blocks
4) Changes block permissions
Answer : Alters the block view output
Which command in Drush can be used to clear all caches?
1) drush cr
2) drush cache-clear
3) drush cc all
4) drush clear-cache
Answer : drush cc all
What is the purpose of `hook_preprocess_page()`?
1) Prepare variables for page templates
2) Create new pages
3) Delete pages
4) Manage page settings
Answer : Prepare variables for page templates
Which function is used to load a user by their ID in Drupal?
1) user_load()
2) drupal_user_load()
3) load_user()
4) get_user_by_id()
Answer : user_load()
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 : Alter entity types
What is the command to enable a module in Drush?
1) drush en module_name
2) drush module-enable module_name
3) drush enable module_name
4) drush activate module_name
Answer : drush en module_name
What does `hook_field_widget_form()` allow you to do?
1) Alter field widget forms
2) Create field widgets
3) Delete field widgets
4) Manage field settings
Answer : Alter field widget forms
Which file contains the settings for a Drupal site?
1) settings.php
2) config.php
3) site-settings.php
4) drupal-settings.php
Answer : settings.php
What does the command `drush pm-list` do?
1) Lists installed and available modules
2) Lists users
3) Lists nodes
4) Lists configurations
Answer : Lists installed and available modules
What is the purpose of the `hook_menu_item_alter()` function?
1) Alters menu items
2) Creates new menu items
3) Deletes menu items
4) Changes menu permissions
Answer : Alters menu items