









































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Tests the technical and development skills required for Drupal 9, including module development, theme creation, performance optimization, and debugging in Drupal’s backend.
Typology: Exams
1 / 81
This page cannot be seen from the preview
Don't miss anything!










































































Question 1. Which HTML5 element should be used to define the main content area of a web page, excluding headers, footers, and sidebars? A) section B) main C) article D) aside Answer: B Explanation: The `` element is intended for the dominant content of the , excluding headers, footers, and sidebars. Question 2. What is the primary benefit of using ARIA (Accessible Rich Internet Applications) attributes in HTML? A) Improves site speed B) Enhances SEO C) Improves accessibility for assistive technologies D) Reduces server load Answer: C Explanation: ARIA attributes provide additional semantics to assistive technologies, improving accessibility for users with disabilities. Question 3. Which CSS3 property is used to create a flexible container that can adjust its items' sizes and positions dynamically? A) float B) grid-template C) display: flex D) position: relative Answer: C
Explanation: display: flex enables Flexbox layout, allowing flexible arrangement of container items. Question 4. How can you select all <p> elements inside a </p> with the CSS selector? A) div > p B) div.p C) p, div D) div p Answer: D Explanation: div p selects all <p> elements that are descendants of a </p>. Question 5. Which JavaScript method is used to attach an event handler to a DOM element? A) addEvent B) attachEvent C) addEventListener D) onEvent Answer: C Explanation: addEventListener is the standard method to attach event handlers to DOM elements. Question 6. What is the output of the following JavaScript code?
console.log(typeof null);A) "null" B) "object" C) "undefined"
Answer: B Explanation: composer update updates all dependencies according to composer.json. Question 10. What is the default branch name when initializing a new Git repository (since 2020)? A) master B) main C) dev D) production Answer: B Explanation: The default branch name is now main instead of master in recent versions of Git. Question 11. Which PSR standard defines autoloading classes from file paths? A) PSR- 1 B) PSR- 2 C) PSR- 4 D) PSR- 7 Answer: C Explanation: PSR-4 describes a specification for autoloading classes from file paths. Question 12. What is the correct syntax for defining a trait in PHP? A) class MyTrait {} B) interface MyTrait {} C) trait MyTrait {} D) module MyTrait {} Answer: C
Explanation: Traits are defined using the trait keyword in PHP. Question 13. Which file stores the exact versions of installed Composer packages? A) composer.json B) composer.lock C) package.json D) dependencies.lock Answer: B Explanation: composer.lock records exact installed versions to ensure consistency across environments. Question 14. How do you switch to a new branch named "feature" in Git? A) git branch feature B) git checkout - b feature C) git merge feature D) git add feature Answer: B Explanation: git checkout - b feature creates and checks out a new branch named "feature." Question 15. Which HTML5 element represents a self-contained piece of content, such as a blog post? A) div B) span C) article D) main Answer: C
Explanation: Add a Comment field to the content type to enable comments for it. Question 19. What is the purpose of Form Modes in Drupal? A) To control how forms are displayed and processed B) To manage user permissions C) To aggregate cache D) To optimize SQL queries Answer: A Explanation: Form Modes allow different presentations of entity forms (e.g., node edit forms). Question 20. Which Drupal feature allows you to create custom image sizes and effects for uploaded images? A) Image Styles B) Taxonomy terms C) Pathauto D) CKEditor Answer: A Explanation: Image Styles let you define custom sizes and effects for images. Question 21. What does the Block Layout system in Drupal do? A) Manages field storage B) Controls the placement of blocks in theme regions C) Handles database updates D) Optimizes performance Answer: B
Explanation: The Block Layout system lets you assign blocks to theme regions. Question 22. Which Drupal component is used to build and manage site navigation menus? A) Taxonomy B) Menu C) View D) Comment Answer: B Explanation: Menus are used to build and manage site navigation in Drupal. Question 23. Which View feature allows dynamic filtering based on the context of the page (e.g., current user or node ID)? A) Filter criteria B) Relationships C) Contextual filters D) Aggregation Answer: C Explanation: Contextual filters filter results dynamically based on page context. Question 24. What is the purpose of the settings.php file in Drupal? A) To manage content types B) To store environment-specific configuration C) To handle caching D) To define custom modules Answer: B
Explanation: Twig uses double curly braces to print variables. Question 28. What is a theme region in Drupal? A) A CSS class B) An area in a template where blocks can be placed C) A database table D) A field type Answer: B Explanation: Regions are areas in a theme template where blocks or content can be rendered. Question 29. How are CSS and JavaScript files attached to a theme in Drupal 9? A) Through .module files B) Using the .libraries.yml file C) By editing the database D) Through the admin interface only Answer: B Explanation: Asset libraries are defined in the .libraries.yml file and attached in code or templates. Question 30. What does a pre-process function in Drupal theming do? A) Modifies data before rendering in a template B) Adds CSS to the theme C) Updates the database D) Handles AJAX requests Answer: A
Explanation: Pre-process functions are used to alter or add variables before passing them to Twig templates. Question 31. What is the minimal required file for a custom module in Drupal 9? A) .module file B) .info.yml file C) .libraries.yml file D) .routing.yml file Answer: B Explanation: The .info.yml file is required to declare a Drupal module. Question 32. Which Drupal hook allows you to alter the structure of an existing form? A) hook_menu B) hook_form_alter C) hook_entity_update D) hook_node_access Answer: B Explanation: hook_form_alter is used to alter any form in Drupal. Question 33. What is Dependency Injection in Drupal? A) A way to inject CSS into templates B) The process of providing a class with its dependencies from the service container C) Adding data to forms D) Injecting SQL queries Answer: B
Explanation: The correct, modern method is using entityTypeManager and getStorage. Question 37. What is Entity Query used for in Drupal? A) Writing raw SQL B) Retrieving entities using an abstract API C) Adding configuration D) Handling caching Answer: B Explanation: Entity Query allows complex querying of entities without writing SQL. Question 38. Which method is used to define form structure in a custom Form class in Drupal? A) validateForm B) buildForm C) submitForm D) getForm Answer: B Explanation: buildForm() defines the structure and elements of the form. Question 39. What is the purpose of hook_update_N in Drupal? A) To alter forms B) To define database update functions on module update C) To register services D) To add menu links Answer: B Explanation: hook_update_N is used to define incremental database updates for modules.
Question 40. Which API should be used to store simple configuration data in Drupal? A) State API B) Configuration API C) Database API D) Cache API Answer: B Explanation: The Configuration API is intended for storing site config data. Question 41. When should you use the State API in Drupal? A) For user session data B) For configuration settings C) For ephemeral, non-configuration data D) For caching Answer: C Explanation: State API is for non-configuration data that is environment-specific and temporary. Question 42. What is the main advantage of using the Database API over writing raw SQL in Drupal? A) Faster performance B) Security and portability C) More storage D) Less code Answer: B Explanation: The Database API prevents SQL injection and works across different database backends.
A) Drush B) XDebug C) PHPMyAdmin D) Composer Answer: B Explanation: XDebug is a PHP extension for step-debugging code. Question 47. What is the White Screen of Death (WSOD) in Drupal? A) A theme error B) A blank page due to a fatal error C) A cache clear result D) A database connection error Answer: B Explanation: WSOD is a blank page, usually caused by a PHP fatal error. Question 48. Which Drush command rebuilds Drupal’s cache? A) drush cr B) drush updb C) drush cim D) drush uli Answer: A Explanation: drush cr ("cache-rebuild") clears all caches. Question 49. What is the role of Internal Page Cache in Drupal? A) Caches pages for anonymous users
B) Caches CSS files C) Caches only admin pages D) Caches database queries Answer: A Explanation: Internal Page Cache caches full HTML for anonymous users for performance. Question 50. Which configuration can most affect Drupal performance if disabled? A) Aggregation of CSS/JS B) Disabling user comments C) Disabling taxonomy D) Disabling views Answer: A Explanation: CSS/JS aggregation reduces HTTP requests and improves performance. Question 51. What Drupal feature helps prevent Cross-Site Scripting (XSS) in custom output? A) Using t() or Twig's escape filters B) Using raw HTML C) Printing variables directly D) Disabling caching Answer: A Explanation: t() and Twig's escape filter sanitize output to prevent XSS. Question 52. How do you safely output a variable in Twig? A) {{ variable|escape }} B) {{ variable|raw }}
C) Automated Tests D) PHPUnit Answer: D Explanation: Drupal uses PHPUnit for automated testing. Question 56. What is a Kernel test in Drupal? A) A test running with a full browser B) A test running with a bootstrapped Drupal environment but no web server C) A unit test with no framework D) A performance test Answer: B Explanation: Kernel tests use a partial Drupal environment for testing. Question 57. What is the purpose of hook_post_update_NAME in Drupal? A) To update the database B) To apply configuration changes after an update C) To install modules D) To enable themes Answer: B Explanation: hook_post_update_NAME runs after updates, typically for configuration changes. Question 58. Which Drupal version update type may require manual code and database changes? A) Patch update B) Minor update C) Major update
D) Security update Answer: C Explanation: Major updates (e.g., D9 to D10) might require manual intervention. Question 59. What is the function of the .libraries.yml file in a Drupal theme or module? A) Stores permissions B) Defines CSS and JS asset libraries C) Registers routes D) Configures caching Answer: B Explanation: .libraries.yml files define asset groups for inclusion in pages. Question 60. What is a theme suggestion in Drupal? A) A proposed field name B) A specific template file name for an entity or view C) A menu item D) A cache tag Answer: B Explanation: Theme suggestions allow for specific template overrides based on context. Question 61. What does the Cache API's max-age property control? A) How long an item remains cached B) The size of the cache C) The cache index D) The number of cache bins