Learn Drupal MCQs

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

Which function is used to retrieve a variable from the state in Drupal?

1) state_get()

2) drupal_get_state()

3) state_variable()

4) get_state()

Answer : drupal_get_state()

What is the default theme in Drupal 8?

1) Bartik

2) Seven

3) Stable

4) Garland

Answer : Bartik

Which hook is used to define custom permissions in Drupal?

1) hook_permission()

2) hook_user_permissions()

3) hook_access()

4) hook_access_control()

Answer : hook_permission()

What does the `hook_views_pre_render()` function do?

1) Alters the view before rendering

2) Creates a new view

3) Deletes a view

4) Modifies the view settings

Answer : Alters the view before rendering

What is the purpose of `hook_preprocess_field()`?

1) To prepare variables for field templates

2) To create new fields

3) To delete fields

4) To display field data

Answer : To prepare variables for field templates

Which command is used to update Drupal core using Drush?

1) drush pm-update drupal

2) drush core-update

3) drush update-core

4) drush update drupal

Answer : drush pm-update drupal

What is the function to load a configuration object in Drupal?

1) config_load()

2) drupal_config()

3) config()

4) load_config()

Answer : config()

Which of the following is a valid YAML file used in Drupal?

1) my_module.yml

2) my_module.yaml

3) my_module.yaml.txt

4) my_module.yaml.info

Answer : my_module.yml

What does the `hook_block_info()` function do?

1) Defines block types

2) Creates blocks

3) Deletes blocks

4) Alters block settings

Answer : Defines block types

What is the function used to set a message in Drupal?

1) drupal_set_message()

2) set_message()

3) drupal_message()

4) message_set()

Answer : drupal_set_message()