Learn Drupal MCQs
Prepare Drupal MCQs (Multiple choice Questions) for exam and job interviews.
What is the purpose of `hook_user_presave()`?
1) Perform actions before saving a user
2) Create a new user
3) Delete a user
4) Update a user
Answer : Perform actions before saving a user
What does the command `drush en` do?
1) Enables a module
2) Lists all modules
3) Disables a module
4) Updates a module
Answer : Enables a module
What is the primary purpose of a Drupal theme?
1) To control the look and feel of the site
2) To manage users
3) To configure modules
4) To store data
Answer : To control the look and feel of the site
Which command is used to disable a module in Drush?
1) drush pm-disable module_name
2) drush disable module_name
3) drush module-disable module_name
4) drush pm-dis module_name
Answer : drush pm-disable module_name
What does the `hook_entity_update()` function allow you to do?
1) Perform actions after an entity is updated
2) Create new entities
3) Delete entities
4) Alter entity permissions
Answer : Perform actions after an entity is updated
What is the purpose of the `hook_node_view()` function?
1) Alters the node display
2) Creates new nodes
3) Deletes nodes
4) Manages node settings
Answer : Alters the node display
Which function is used to retrieve user roles in Drupal?
1) user_roles()
2) user_load_roles()
3) drupal_get_user_roles()
4) get_user_roles()
Answer : user_load_roles()
What command would you use to clear the cache for a specific service?
1) drush cache-clear service_name
2) drush cache-rebuild service_name
3) drush cr service_name
4) drush clear-cache service_name
Answer : drush cache-clear service_name
What does `hook_field_widget_info()` do?
1) Defines field widgets
2) Creates new fields
3) Deletes field widgets
4) Manages field settings
Answer : Defines field widgets
Which function is used to get all available themes in Drupal?
1) theme_list()
2) drupal_get_themes()
3) system_theme_list()
4) get_available_themes()
Answer : system_theme_list()