Learn Drupal MCQs
Prepare Drupal MCQs (Multiple choice Questions) for exam and job interviews.
Which of the following is NOT a valid cache bin in Drupal?
1) cache_page
2) cache_render
3) cache_database
4) cache_data
Answer : cache_database
What is the primary role of the `hook_init()` function in Drupal?
1) To perform actions at the beginning of a page request
2) To render forms
3) To define routes
4) To manage user permissions
Answer : To perform actions at the beginning of a page request
What is a "view" in Drupal?
1) A way to display content
2) A user role
3) A type of field
4) A theme
Answer : A way to display content
What does the `drupal_set_message()` function do?
1) Displays a message to the user
2) Saves data to the database
3) Modifies the theme
4) Clears the cache
Answer : Displays a message to the user
Which of the following is true about Drupal`s REST API?
1) It allows you to access Drupal content via HTTP
2) It is enabled by default
3) It supports JSON format
4) Both a and c
Answer : Both a and c
What is the purpose of `hook_preprocess_HOOK()` in Drupal?
1) To modify variables before rendering
2) To alter the database
3) To create custom fields
4) To manage permissions
Answer : To modify variables before rendering
Which command is used to run database updates in Drupal?
1) drush updatedb
2) drush db-update
3) drush update
4) drush database-update
Answer : drush updatedb
What is the function used to create a route in Drupal 8?
1) hook_menu()
2) route()
3) hook_routes()
4) Drupal::route()
Answer : hook_routes()
Which of the following is a type of field in Drupal?
1) Text
2) Image
3) File
4) All of the above
Answer : All of the above
What is the main purpose of the `hook_schema()` function in Drupal?
1) To define database tables
2) To create forms
3) To generate views
4) To manage permissions
Answer : To define database tables