Learn Drupal MCQs

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

Which function is used to get a list of available modules in Drupal?

1) module_list()

2) drupal_get_modules()

3) system_module_list()

4) get_available_modules()

Answer : system_module_list()

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

1) Alter an entity before it is saved

2) Create a new entity

3) Delete an entity

4) Update an entity

Answer : Alter an entity before it is saved

Which file contains the settings for database connection in Drupal?

1) settings.php

2) database.php

3) config.php

4) settings.local.php

Answer : settings.php

What does the command `drush cr` do?

1) Clears the cache

2) Rebuilds the cache

3) Lists the cache

4) Deletes cache files

Answer : Rebuilds the cache

Which function is used to define routes in Drupal 8 and above?

1) hook_menu()

2) hook_route()

3) hook_menu_routes()

4) hook_menu_item()

Answer : hook_menu()

What is the command to export the database using Drush?

1) drush sql-dump

2) drush db-export

3) drush export-db

4) drush dump-db

Answer : drush sql-dump

What does `hook_theme_suggestions_HOOK_alter()` do?

1) Alters theme suggestions for a specific hook

2) Creates new theme hooks

3) Deletes theme suggestions

4) Manages theme settings

Answer : Alters theme suggestions for a specific hook

Which command is used to check for updates in Drush?

1) drush pm-update

2) drush pm-updates

3) drush update-status

4) drush check-updates

Answer : drush pm-update

What does the `hook_preprocess_field()` function do?

1) Alters field output

2) Creates new fields

3) Deletes fields

4) Manages field settings

Answer : Alters field output

Which function is used to load a node in Drupal?

1) node_load()

2) drupal_node_load()

3) load_node()

4) get_node_by_id()

Answer : node_load()