Learn Drupal MCQs
Prepare Drupal MCQs (Multiple choice Questions) for exam and job interviews.
Which function is used to redirect users to a different page in Drupal?
1) drupal_goto()
2) redirect_user()
3) drupal_redirect()
4) goto_page()
Answer : drupal_goto()
What does `hook_entity_insert()` do?
1) Runs after an entity is saved
2) Runs before an entity is saved
3) Creates a new entity
4) Deletes an entity
Answer : Runs after an entity is saved
What file defines a theme in Drupal 8?
1) .info.yml
2) .theme
3) .info
4) .theme.info
Answer : .info.yml
What is the function used to get the current user in Drupal?
1) user_load_current()
2) user_current()
3) user_load()
4) current_user()
Answer : user_load_current()
What does the `hook_preprocess_HOOK()` function allow you to do?
1) Prepare variables for templates
2) Create new hooks
3) Delete hooks
4) Manage user permissions
Answer : Prepare variables for templates
Which of the following is a way to define routes in Drupal?
1) YAML files
2) PHP files
3) HTML files
4) XML files
Answer : YAML files
What is the purpose of the `hook_menu_local_tasks_alter()` function?
1) To alter local tasks
2) To create menu items
3) To delete menu items
4) To define permissions
Answer : To alter local tasks
What is the function used to render a form in Drupal?
1) drupal_get_form()
2) form_render()
3) render_form()
4) drupal_render_form()
Answer : drupal_get_form()
In Drupal, what is the primary function of `hook_theme()`?
1) To define theme hooks
2) To create templates
3) To alter themes
4) To manage styles
Answer : To define theme hooks
Which command is used to check the status of Drupal modules in Drush?
1) drush pm-status
2) drush status
3) drush module-status
4) drush check-status
Answer : drush pm-status