Drupal Architect Interview Questions & Answers
Drupal Architecture & Development
Q: What is the difference between a custom module and a contributed module in Drupal?
A: Contributed Module: Developed and shared by the Drupal community, hosted on drupal.org.
Custom Module: Tailored to specific project needs, created by developers for a particular site.
Q: Explain the Drupal 8/9/10 plugin system.
A: Plugins are small pieces of functionality that are swappable and follow the Plugin API.
They use annotations (@Plugin) and are discovered using plugin managers.
Examples include: Blocks, Field formatters, Image effects, etc.
Q: What is a service in Drupal and how is it defined?
A: A service is an object managed by the Symfony Dependency Injection Container.
Defined in *.services.yml and injected using service container.
Q: How does Drupal handle configuration management?
A: Through YAML files in the config/sync directory. Used with commands like drush config-export and drush
config-import.
Q: How would you implement multi-site architecture in Drupal?
A: Share core codebase, separate sites/site1.com/settings.php, symbolic links or composer for shared modules/themes.
PHP Core & OOP
Q: What is the difference between abstract class and interface in PHP?
A: Abstract Class: Can have method implementations.
Interface: Only method declarations. Multiple interfaces can be implemented, only one abstract class can be extended.
Q: Explain Dependency Injection and its benefit.
A: Passing dependencies via constructor or method. Promotes loose coupling and easier testing.
Q: What is the difference between __construct() and __invoke()?
A: __construct(): Initializes the object.
Drupal Architect Interview Questions & Answers
__invoke(): Allows an object to be called as a function.
Q: What is late static binding in PHP?
A: Uses static:: instead of self:: to refer to the class that called the method, not the class it is defined in.
Q: Explain traits in PHP.
A: Traits allow reuse of methods across multiple classes.
Example:
trait Logger {
public function log($msg) { echo $msg; }
} class MyClass { use Logger; }
MySQL & Database Design
Q: Explain normalization and its types.
A: 1NF: Atomic columns
2NF: No partial dependency
3NF: No transitive dependency
Q: What is the difference between JOIN, LEFT JOIN, and INNER JOIN?
A: JOIN/INNER JOIN: Returns matching rows from both tables.
LEFT JOIN: All rows from the left and matched rows from the right.
Q: How would you optimize a slow query?
A: Use EXPLAIN, add indexes, avoid SELECT *, optimize joins.
Q: What is a covering index?
A: An index that contains all columns needed by a query, reducing table lookups.
Q: Difference between InnoDB and MyISAM?
A: InnoDB: Supports transactions, row-level locking, foreign keys.
MyISAM: Faster read, table-level locking.