Learn Drupal MCQs

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

What is the function of `hook_node_view()`?

1) Alter the display of nodes

2) Create new nodes

3) Delete nodes

4) Manage node permissions

Answer : Create new nodes

Which of the following is an essential security best practice in Drupal?

1) Update modules regularly

2) Disable all modules

3) Clear the cache frequently

4) Create new themes regularly

Answer : Update modules regularly

What is the purpose of `hook_node_access()`?

1) Control access to nodes

2) Create new access roles

3) Delete nodes

4) Alter node permissions

Answer : Create new access roles

Which Drush command is used to uninstall a module?

1) drush pm-uninstall

2) drush uninstall

3) drush remove-module

4) drush module-uninstall

Answer : drush pm-uninstall

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

1) Run actions when a module is installed

2) Create new modules

3) Delete modules

4) Manage installation settings

Answer : Run actions when a module is installed

Which file is essential for defining a Drupal theme?

1) theme_name.info.yml

2) theme_name.theme

3) theme_name.install

4) theme_name.module

Answer : theme_name.theme

What does `hook_uninstall()` do?

1) Runs when a module is uninstalled

2) Runs when the cache is cleared

3) Runs when the database is updated

4) Runs during the cron job

Answer : Runs when the cache is cleared

Which of the following is a method to check the status of Drupal modules?

1) drush pm-list

2) drush module-status

3) drush list-modules

4) drush status-modules

Answer : drush pm-list

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

1) Prepare variables for templates

2) Create new templates

3) Delete templates

4) Manage template settings

Answer : Prepare variables for templates

What is the purpose of `hook_user_login()`?

1) Runs when a user logs in

2) Creates new users

3) Manages user roles

4) Deletes users

Answer : Creates new users