Learn Drupal MCQs
Prepare Drupal MCQs (Multiple choice Questions) for exam and job interviews.
What is the purpose of `hook_views_query_alter()`?
1) To alter the views query
2) To create new views
3) To delete views
4) To manage view settings
Answer : To alter the views query
What is the purpose of `hook_entity_view()`?
1) To alter the entity display
2) To create new entities
3) To delete entities
4) To manage entity permissions
Answer : To alter the entity display
Which function is used to get the current user in Drupal?
1) user_load()
2) drupal_get_current_user()
3) current_user()
4) get_current_user()
Answer : drupal_get_current_user()
What does `hook_form_alter()` allow you to do?
1) Alter any form
2) Create new forms
3) Delete forms
4) Manage form submissions
Answer : Alter any form
What is the function used to get all the fields of an entity in Drupal?
1) entity_field_info()
2) field_info()
3) entity_get_fields()
4) get_entity_fields()
Answer : entity_field_info()
What does the command `drush cache-rebuild` do?
1) Rebuilds all caches
2) Clears specific caches
3) Clears all caches
4) Deletes cache files
Answer : Rebuilds all caches
Which command is used to enable a module in Drush?
1) drush pm-enable module_name
2) drush enable module_name
3) drush module-enable module_name
4) drush pm-en module_name
Answer : drush pm-enable module_name
What does `hook_views_post_execute()` do?
1) Runs after a view is executed
2) Runs before a view is executed
3) Alters the view
4) Creates a new view
Answer : Runs after a view is executed
Which of the following can be used to define a block in Drupal?
1) hook_block_info()
2) hook_block()
3) hook_block_define()
4) hook_block_create()
Answer : hook_block_info()
What is the purpose of `hook_block_view_alter()`?
1) Alter block view output
2) Create new blocks
3) Delete blocks
4) Manage block permissions
Answer : Alter block view output