Learn Drupal MCQs

Prepare Drupal MCQs (Multiple choice Questions) for exam and job interviews.

Which command is used to run Drupal`s database updates?

1) drush updatedb

2) drush db-update

3) drush run-updates

4) drush run-db-updates

Answer : drush updatedb

What is the purpose of `hook_update_N()` in Drupal?

1) To perform database updates

2) To define routes

3) To manage permissions

4) To create forms

Answer : To perform database updates

Which of the following is a type of caching available in Drupal?

1) Page cache

2) Dynamic cache

3) Block cache

4) All of the above

Answer : All of the above

What is the purpose of the `hook_user_logout()` function?

1) To perform actions after a user logs out

2) To create a new user

3) To delete a user

4) To modify user roles

Answer : To perform actions after a user logs out

What does the `hook_form_FORM_ID_alter()` function allow you to do?

1) Modify a specific form

2) Create a new form

3) Delete a form

4) Display a form

Answer : Modify a specific form

What is the command to clear all caches in Drupal using Drush?

1) drush cache-rebuild

2) drush clear-cache

3) drush cc all

4) drush cache-clear

Answer : drush cache-rebuild

Which hook is invoked when a user is created in Drupal?

1) hook_user_insert()

2) hook_user_create()

3) hook_user_save()

4) hook_user_add()

Answer : hook_user_insert()

What does `hook_block_view()` do in Drupal?

1) Defines block content

2) Creates a new block

3) Alters existing blocks

4) None of the above

Answer : Defines block content

Which of the following is used to create a new view in Drupal?

1) Views UI

2) Content Types

3) Taxonomy

4) Custom Modules

Answer : Views UI

What is the main purpose of `hook_init()`?

1) Runs code on every page request

2) Sets up caching

3) Defines routes

4) None of the above

Answer : Runs code on every page request