Learn Drupal MCQs

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

What does the `hook_views_post_execute()` function 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 : Alters the view

What is the function of the `drupal_path_alias()` function?

1) Get the alias for a given path

2) Create new path aliases

3) Delete path aliases

4) Manage path settings

Answer : Get the alias for a given path

Which command is used to clear the cache in Drush?

1) drush cr

2) drush cache-clear

3) drush clear-cache

4) drush cache-rebuild

Answer : drush cache-clear

What is the purpose of `hook_entity_presave()`?

1) Modify an entity before it is saved

2) Create new entities

3) Delete entities

4) Manage entity permissions

Answer : Modify an entity before it is saved

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

1) Provides documentation for a module

2) Creates a new module

3) Modifies a module

4) Deletes a module

Answer : Creates a new module

What is a content type in Drupal?

1) A predefined type of content

2) A user role

3) A theme

4) A module

Answer : A predefined type of content

Which function is used to translate strings in Drupal?

1) t()

2) translate()

3) locale()

4) gettext()

Answer : t()

What is the purpose of `hook_init()`?

1) Runs during page initialization

2) Executes when the cache is cleared

3) Runs during the cron job

4) Executes when the database is updated

Answer : Executes when the cache is cleared

Which module is used to manage user permissions in Drupal?

1) User Permissions

2) Pathauto

3) Views

4) Roles

Answer : User Permissions

In Drupal 8, what is a service?

1) A reusable piece of functionality

2) A type of content

3) A user role

4) A module

Answer : A type of content