Learn Drupal MCQs
Prepare Drupal MCQs (Multiple choice Questions) for exam and job interviews.
Which command is used to install a Drupal site using Drush?
1) drush site-install
2) drush install
3) drush site-setup
4) drush setup
Answer : drush site-install
What does `hook_theme()` define in a module?
1) Theme hooks and templates
2) Form submissions
3) User permissions
4) Menu items
Answer : Theme hooks and templates
What is the purpose of the `hook_form_FORM_ID_alter()` function?
1) To alter specific forms
2) To create forms
3) To delete forms
4) To manage form permissions
Answer : To alter specific forms
What command would you use to update the database schema in Drupal?
1) drush updatedb
2) drush db-update
3) drush update-schema
4) drush db-upgrade
Answer : drush updatedb
What does the `hook_page_attachments()` function do?
1) Add CSS/JS files to pages
2) Create new pages
3) Delete attachments
4) Manage page settings
Answer : Add CSS/JS files to pages
Which function retrieves configuration from the site in Drupal?
1) drupal_get_config()
2) config_get()
3) get_config()
4) config()
Answer : get_config()
What does the `hook_field_formatter_info()` function do?
1) Defines field formatters
2) Creates new fields
3) Deletes fields
4) Manages field settings
Answer : Defines field formatters
Which file would you use to define custom permissions in Drupal?
1) module.permissions.yml
2) module.permissions.yaml
3) permissions.yml
4) permissions.yaml
Answer : module.permissions.yml
What does the command `drush config-import` do?
1) Imports configuration from files
2) Exports configuration to files
3) Lists configuration settings
4) Clears configuration cache
Answer : Imports configuration from files
Which function is used to redirect users in Drupal?
1) drupal_goto()
2) redirect()
3) drupal_redirect()
4) user_redirect()
Answer : drupal_goto()