Learn Drupal MCQs

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

What is the default theme engine used in Drupal 8?

1) Twig

2) PHPTemplate

3) Smarty

4) None of the above

Answer : Twig

Which of the following is a valid way to implement caching in Drupal?

1) Using Cache API

2) Using Views

3) Using custom modules

4) All of the above

Answer : All of the above

What is the command to disable a module in Drupal using Drush?

1) drush dis module_name

2) drush disable module_name

3) drush module-disable

4) drush rm module_name

Answer : drush dis module_name

What is the function used to load a node in Drupal?

1) node_load()

2) load_node()

3) get_node()

4) drupal_node()

Answer : node_load()

Which of the following is a common way to add CSS in Drupal 8?

1) Using `drupal_add_css()`

2) Using `libraries.yml`

3) Using `theme-settings.php`

4) Using `hook_css_alter()`

Answer : Using `libraries.yml`

What is the primary role of the `hook_help()` function?

1) To provide help text

2) To create custom routes

3) To alter forms

4) To manage permissions

Answer : To provide help text

In Drupal, what does `hook_node_insert()` do?

1) Runs after a node is created

2) Runs before a node is created

3) Runs when a node is deleted

4) None of the above

Answer : Runs after a node is created

What is the primary purpose of `hook_preprocess_node()`?

1) To modify the output of a node

2) To create a new node

3) To delete a node

4) To manage users

Answer : To modify the output of a node

Which command is used to install a module using Drush?

1) drush en module_name

2) drush install module_name

3) drush activate module_name

4) drush module-enable module_name

Answer : drush en module_name

What is the function used to check if a user has a specific permission?

1) user_access()

2) has_permission()

3) check_permission()

4) access_user()

Answer : user_access()