Drupal interview questions for experienced Drupal Developer

I always take interview of many types of developers. These days drupal developers are really in demand but choosing right candidate who knows the drupal in and out is very difficult. So I created some very unique interview questions for experienced Drupal Developer and answers.
Experienced Drupal Developer needs Following strong knowledge:
Linux, Mysql, PHP, CSS and HTML, Apache, Software Design Methods, jQuery and AJAX, Drupal itself, Security, Search Engine Optimization

What is different between d6 and d7?
Ans: check this URL :https://drupal.org/about/new-in-drupal-7

What are systems requirements for drupal installation ?
Ans:    Database: MySQL 5.0.15 or PostgreSQL 8.3
PHP Version 5.2 or higher
PHP Memory: 40M – 64M

what is entity  and entity api?
Ans: They provide a unified way to work with different data units in Drupal. Drupal 7 is all about entities. They are everywhere: nodes, users, taxonomy terms, vocabularies…

But how, as developers, can we create our own entities? When do we really need to do that? I think these questions are really very project-specific. We can probably use nodes for nearly everything. But when it comes to performance-sensitive projects, nodes should really only be used for content, and we should separate as much as possible from nodes. Why? Nodes are revisioned, they fire a lot of hooks, and they have functionality that we likely won’t need. Also if we know exactly what fields we should have in our entities, we can create our own custom entities to avoid all those joins of Field API tables.

what is use of user entity?
Ans: Check this URL: https://drupal.org/node/1261744

What is hooks?
Ans:Allow modules to interact with the Drupal core.

Drupal’s module system is based on the concept of “hooks”. A hook is a PHP function that is named foo_bar(), where “foo” is the name of the module (whose filename is thus foo.module) and “bar” is the name of the hook. Each hook has a defined set of parameters and a specified result type.

How to do the for drupal debugging
Ans: – use devel module and Use xdebug  application

Which files are required for theme?
Ans: style.css, page.tpl.php, info file, template.php, node.tpl.php, block.tpl.php

Which files are required for module?
Ans: modulename.info, modulename.module, optional modulename.install

which are common modules used in project?
Ans: WebformDevel, Drush, ViewsBackup & Migrate, Date, Address field, file field, link, media, Rules, SMTP, View Slideshow, Print,
Lightbox2, Varnish, memcache, Wysiwyg, ckeditor, Google Analytics, Metatag, XML Site Map, Redirect, Page Title, Chaos Tools,Token, Entity, Panels, Features, Coder

What is Drush – how drush is used?
Ans: Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

what is PDO?
Ans: PDO is an acronym for PHP Data Objects. PDO is a lean, consistent way to access databases. This means developers can write portable code much easier. PDO is not an abstraction layer like PearDB. PDO is a more like a data access layer which uses a unified API (Application Programming Interface).

How PDO used in drupal?
Ans: Drupal provides a database abstraction layer to provide developers with the ability to support multiple database servers easily. The intent of this layer is to preserve the syntax and power of SQL as much as possible, but also allow developers a way to leverage more complex functionality in a unified way. It also provides a structured interface for dynamically constructing queries when appropriate, and enforcing security checks and similar good practices.

The system is built atop PHP’s PDO (PHP Data Objects) database API and inherits much of its syntax and semantics.
More: https://api.drupal.org/api/drupal/includes!database!database.inc/group/database/7

How to use preprocess function?
Ans:The main role of the preprocessor is to set up variables to be placed within the template (.tpl.php) files. From Drupal 7 they apply to templates and functions, whereas in Drupal 6 preprocess functions only apply to theming hooks implemented as templates. Plain theme functions do not interact with preprocessors.
More: https://drupal.org/node/223430
https://api.drupal.org/api/drupal/modules!field!field.module/function/template_preprocess_field/7

Where to use the theme hook?
Ans: template.php in theme folder

What is use of template.php file?
Ans: Overriding other theme functions. If you want to override a theme function not included in the basic list (block, box, comment, node, page), you need to tell PHPTemplate about it.

To do this, you need to create a template.php file in your theme’s directory. This file must start with a PHP opening tag

What is subtheme?
Ans:A Drupal subtheme (or sub-theme) is a theme that is based on a “base theme”. The base theme provides basic (and sometimes more than basic) functionality. The subtheme styles the site with a unique look, and adds any unique extra functionality.

Which modules used for data migration?
Ans: Feeds – https://drupal.org/project/feeds
Import or aggregate data as nodes, users, taxonomy terms or simple database records.

How to handle localization in drupal?
Ans: Drupal 7 supports the localization.

How to use the multiple themes in one project?
Ans: use the global variable, default_theme.

How can prevent or restrict multiple login in drupal
Ans: Use the Session Limit Module – https://drupal.org/project/session_limit

While doing the migration how date will be migrated. (is there any with date migration)
Ans: There will be issue with date format. It takes only unix time format.

How can we set the region in drupal theme?
Ans: You can set the regions in themename.info file. Following is the example:
regions[header] = Header
regions[content_header] = Content Header
regions[content] = Content
regions[sidebar_second] = Right sidebar

How can we improve the Drupal site performance?
Ans: Use PHP APC, Use memcache, Use the Varnish. Most important module – Use the Boost module. Use Views Cache.
For very high traffic, Use the CDN module. Use the Block Cache.

Which database storage engine is used in d6 and d7?
Ans: Drupal 6 uses the MYISAM and Drupal 7 uses the INODB

Which modules are added in d7 core modules?
Ans: Following modules are added in d7 core.
Entity API
Another API module which is required by many other modules. This module extends core’s entities in lots of useful ways.
Entity Reference
Create relationships between any entities. This is a superior replacement to Node Reference and User Reference in Drupal 6.
Media
Adding media to content was tricky before the media module. This should be installed on every Drupal 7 site.

What is left join and right joins?
Ans:
For the sake of this example, lets say you have 100 students, 70 of which have lockers. You have a total of 50 lockers, 40 of which have at least 1 student.

INNER JOIN is equivalent to “show me all students with lockers”.
Any students without lockers, or any lockers without students are missing.
Returns 70 rows

LEFT OUTER JOIN would be “show me all students, with their corresponding locker if they have one”.
This might be a general student list, or could be used to identify students with no locker.
Returns 100 rows

RIGHT OUTER JOIN would be “show me all lockers, and the students assigned to them if there are any”.
This could be used to identify lockers that have no students assigned, or lockers that have too many students.
Returns 80 rows (list of 70 students in the 40 lockers, plus the 10 lockers with no student)

FULL OUTER JOIN would be silly and probably not much use.
Something like “show me all students and all lockers, and match them up where you can”
Returns 110 rows (all 100 students, including those without lockers. Plus the 10 lockers with no student)

CROSS JOIN is also fairly silly in this scenario.
It doesn’t use the linked “lockernumber” field in the students table, so you basically end up with a big giant list of every possible student-to-locker pairing, whether or not it actually exists.
Returns 5000 rows (100 students x 50 lockers). Could be useful (with filtering) as a starting point to match up the new students with the empty lockers.

How to create the table using module?
Ans: Use following code:
/**
* Implements hook_schema().
*/
function module_name_schema() {
$schema[‘module_name’] = array(
‘fields’ => array(
‘type’ => array(‘type’ => ‘varchar’, ‘length’ => 15, ‘not null’ => TRUE, ‘default’ => ‘node’),
‘id’ => array(‘type’ => ‘int’, ‘unsigned’ => TRUE, ‘not null’ => TRUE, ‘default’ => 0),
‘module_name’ => array(‘type’ => ‘varchar’, ‘length’ => 255, ‘not null’ => TRUE, ‘default’ => ”)
),
‘primary key’ => array(‘type’, ‘id’),
);

return $schema;
}

/**
* Implements hook_uninstall().
*/
function module_name_uninstall() {
// Clear variables
variable_del(‘module_name_default’);

}

How to update table using module?
Ans: You can check the following code:
/**
* Implements hook_update_n().
*/
function module_name_update_6200() {
$ret = array();

if (db_column_exists(‘module_name’, ‘id’)) {
return $ret;
}

db_create_table($ret, ‘module_name_temp’, array(
‘fields’ => array(
‘type’ => array(‘type’ => ‘varchar’, ‘length’ => 15, ‘not null’ => TRUE, ‘default’ => ‘node’),
‘id’ => array(‘type’ => ‘int’, ‘unsigned’ => TRUE, ‘not null’ => TRUE, ‘default’ => 0),
‘module_name’ => array(‘type’ => ‘varchar’, ‘length’ => 255, ‘not null’ => TRUE, ‘default’ => ”)
),
‘primary key’ => array(‘type’, ‘id’),
));

$ret[] = update_sql(‘INSERT INTO {module_name_temp} (id, module_name) SELECT nid, module_name FROM {module_name}’);

db_rename_table($ret, ‘module_name’, ‘module_name_old’);

db_rename_table($ret, ‘module_name_temp’, ‘module_name’);

$display_settings = variable_get(‘module_name_display’, array());
foreach ($display_settings as $type) {
if ($type) {
variable_set(‘module_name_type_’ . $type . ‘_showfield’, 1);
}
}
variable_del(‘module_name_display’);

return $ret;
}

How to drop the table using module?
Ans: Use db_drop_table method in install file

Which hooks you used and what is the purpose of using the those hooks?
Ans: You need to give this answer

How to create install script for drupal module and create tables

Ans: Check answer here

What is responsive theme?

Ans: A responsive theme (as the one used for this website), is an approach to web development that allows a website to break itself down smoothly across multiple monitor sizes, screen resolutions, and platforms, be it a computer, tablet or mobile device. It allows the developer to create a site that is optimized for each platform, both in navigation, readability and load time.

As you can see when resizing the window (if you are viewing this site on a computer), the layout of the page shifts depending on the size of the screen; with different layouts for content depending on viewing area. Themes (or layouts) such as this, allow for a single site and single look to the site, to be viewed on various devices without the need for additional themes or resizing by the user.

How to create the responsive theme?
Ans: You can check the following URL:
http://www.netmagazine.com/tutorials/create-responsive-drupal-theme
http://www.unimitysolutions.com/blog/7-steps-building-responsive-theme-drupal-7

What is difference between innodb and myIsam?
Ans: First major difference I see is that InnoDB implements row-level lock while MyISAM can do only a table-level lock. You will find better crash recovery in InnoDB. However, it doesn’t have FULLTEXT search indexes, as does MyISAM. InnoDB also implements transactions, foreign keys and relationship constraints while MyISAM does not.

What is difference between update and alter query?
Ans: ALTER is a DDL (Data Definition Language) statement. Whereas UPDATE is a DML (Data Manipulation Language) statement. One is used to update the structure of the table (add/remove field/index etc). Whereas UPDATE is used to update data.

What is purpose or use of .htaccess file?
Ans: File_HtAccess provides common methods to create and manipulate Apache / NCSA style .htaccess files. These files together with accompanying password files are used to protect webserver directories. Since File_HtAccess does not provide any means to manipulate or create password files you should use it together with File_Passwd.

What is use of substr and strstr function?
Ans: strstr — Find the first occurrence of a string. substr — Return part of a string.

Can we include one php file multiple times?
Ans: Yes.

What is contextual filter?
Ans: , contextual filters were called arguments in Views and a lot of documentation, tutorials and Views-compatible modules still use that term. If you see the term argument, it should be interpreted either as a contextual filter, or the value provided to a contextual filter.

How to use the contextual filter?
Ans: The classic example of how contextual filter values are provided to views is by the view path. If a view has the path example.com/my-view, the URL example.com/my-view/story/22 will call the view along with two values for contextual filters (in this case story and 22). But there are more ways of providing contextual filter values. These are discussed in Chapter about Page manager and Panels.

What is taxonomy?
Ans: Taxonomy, a powerful core module, gives your sites use of the organizational keywords known in other systems as categories, tags, or metadata. It allows you to connect, relate and classify your website’s content. In Drupal, these terms are gathered within “vocabularies.” The Taxonomy module allows you to create, manage and apply those vocabularies.

New under Drupal 7 is the ability to add taxonomy fields to vocabularies and terms.

How to update the drupal?
Ans: Easiest way is use update.php file. If you installed the drush then you can use the following command “drush pm-update”. Do not forget to take file and mysql backup before update.

if we delete the page.tpl.php then drupal site will work or not?
Ans: Yes. will work. It will check for node.tpl.php file.

How to delete drupal cache manually through mysql

Ans: Check answer here

Did you written the query in D7 for your module?
Ans: Check following URL https://api.drupal.org/api/drupal/includes%21database%21database.inc/function/db_query/7

Do you have profile on drupal site? Do you write the comments on Drupal site?
Ans: If you have drupal profile then say yes. If not then create profile now.

Did you contributed the drupal site (any module)?
Ans: Try adding some patches or modules to drupal.

What modules do you always recommend to your clients?
Ans: Views, Panels, Ctools, Token, Pathauto, Webform, Rules, Features, Strongarm, Date, view slideshow, Drush, Entity Reference, QuickTab, Libraries, Google Analytics, Display Suite, Context, Module Filter, CSS Injector, Diff

Which files are required for Creating the Drupal Module?
Ans: MODULENAME.info and MODULENAME.module file are required for creating the module.

Which files are required for Creating the Drupal Theme?
Ans: .info (declares the theme features) and page.tpl.php (defines the layout)

How can we add the new Menu to Drupal Admin section?
Ans: Use following:
Navigate to administer > site building > menus
Select the Add menu tab item
For the title enter Example menu and select to return to the menu list view

How does caching work in Drupal?
Ans: Use this link http://blog.merge.nl/20120118/how-does-caching-work-drupal

What is the use of taxonomy and vocabulary in Drupal?
Ans: Taxonomy, a powerful core module, gives your sites use of the organizational keywords known in other systems as categories, tags, or metadata. It allows you to connect, relate and classify your website’s content. In Drupal, these terms are gathered within “vocabularies.” The Taxonomy module allows you to create, manage and apply those vocabularies.

How to interact with Drupal search system ?
Ans: The search module lets users search for specific content on your site. You can search both for users and for particular words. When you are on the “content” tab of Search, you will be able to search for words appearing in the default rendering of node content on your site, which would include the default rendering of any CCK fields, Location fields, Taxonomy, etc., as well as comments. When you are on the “users” tab of Search, you will be able to search the user names of registered users on your site, and if you have sufficient permissions, also their email addresses.

What are hooks in Drupal?
Ans: hooks are implemented in modules and you can read about the core hooks here: http://api.drupal.org/api/group/hooks/5. Basically they provide a way for a module to extend the functionality of another module. For example the ‘node’ module provides the core features of a node (content type). You can use CCK or a custom module to create a custom content. You can also use the nodeapi hook to extend the functionality of any content type. The are core hooks for working with node, users, taxonomy and more. Contributed module may also add addition hooks your module can implement.

How can add the Captcha in registration page for drupal?
Ans: Use the captcha and recaptcha module.

For Image slider which modules are required in Drupal?
Ans: use Views slideshow, nivo slider modules. there are other modules also.

Can I use Drupal on the command line?
Ans: Use drush.

What does Views do and how do you use it?
Ans:You need Views if:
You like the default front page view, but you find you want to sort it differently.
You like the default taxonomy/term view, but you find you want to sort it differently; for example, alphabetically.
You use /tracker, but you want to restrict it to posts of a certain type.
You like the idea of the ‘article’ module, but it doesn’t display articles the way you like.
You want a way to display a block with the 5 most recent posts of some particular type.
You want to provide ‘unread forum posts’.
You want a monthly archive similar to the typical Movable Type/Wordpress archives that displays a link to the in the form of “Month, YYYY (X)” where X is the number of posts that month, and displays them in a block. The links lead to a simple list of posts for that month.
Views can do a lot more than that, but those are some of the obvious uses of Views.

How do you handle upgrades?
Ans: use update.php or drush command (pm-update)

Which module is required for Google, Facebook, twitter login?
Ans:

Which module can be used for E-commerce?
Ans: Use ubercart module

If I want to add the extra fields in registration field then what should we do?
Ans: Use profile module. In drupal 7 Profile is in core.

How can we modify the form validation of Drupal?
Ans: Use form alter hook and use this “‘#required’ => TRUE”

Which are the core required modules in drupal 6.x
Ans: Check this URL : https://drupal.org/node/1283408

How to enable clean urls in drupal ?
Ans: apache support is needed for this. Then enable from admin.

What is PDO?
Ans:PDO is an acronym for PHP Data Objects. PDO is a lean, consistent way to access databases. This means developers can write portable code much easier. PDO is not an abstraction layer like PearDB. PDO is a more like a data access layer which uses a unified API (Application Programming Interface).

What is a patch in Drupal and how will we apply patch in drupal?
Ans:A patch is a file that consists of a list of differences between one set of files and another. All code changes, additions, or deletions to Drupal core and contributed modules/themes between developers are done through patches. The differences are presented in a structured, standard way, which means that a program (also named patch) can be used to apply the changes to another copy of the original file.

How to post videos from mobile to Drupal website?
Ans: Use the video module. For bigger sites use brightcove module. https://drupal.org/project/brightcove
This is paid service.

List the SEO modules available in Drupal.
Ans: Use following modules
Pathauto
Nodewords/ Meta tags
Service links
Google analytics
Related Links
Search 404
Site map
Url list

List the modules required for building a social networking website in Drupal.
Ans:
• Advanced Forum
• Advanced Profile Kit
• Application Toolbar (Appbar)
• Author Pane
• Buddylist2 Package
• Buddylist: list your social network
• CiviCRM: manage community contacts, relationships, and activities
• CiviNode and CiviNode CCK: Tools For Integrating CiviCRM Contacts Into Drupal Content
• Comment Notify
• FOAF: friends of a friend
• Facebook-style Statuses
• Family: Record, display, and analyze genealogical data.
• Flag Friend
• Friend
• FriendList
• Front: Show group membership and events
• Gigya Socialize Module
• Invite: send invitations to join your site
• Notice Feed
• Organic Group
• Profile Setup
• Radioactivity
• Sports Pickem
• Tellafriend Node
• User Invite
• User Relationships
• UserTag:Tag …

How To Define New Regions (Sidebar,Header, footer) in Drupal ?
Ans:ADD this code in its entirety to the bottom of your template.php file:

Explain me User, Permission, Role in drupal?
Ans:

Which ORM is used in Drupal 7?
Ans: Doctrine is the ORM.

Which Design Pattern used in Drupal?
Ans: Singleton Design pattern is used in Drupal.

What is the use of features module?
Ans: The features module enables the capture and management of features in Drupal. A feature is a collection of Drupal entities which taken together satisfy a certain use-case.

Features provides a UI and API for taking different site building components from modules with exportables and bundling them together in a single feature module. A feature module is like any other Drupal module except that it declares its components (e.g. views, contexts, CCK fields, etc.) in its .info file so that it can be checked, updated, or reverted programmatically.

Did you used the Panel module? If yes then what is the use of that?
Ans: The Panels module allows a site administrator to create customized layouts for multiple uses. At its core it is a drag and drop content manager that lets you visually design a layout and place content within that layout. Integration with other systems allows you to create nodes that use this, landing pages that use this, and even override system pages such as taxonomy and the node page so that you can customize the layout of your site with very fine grained permissions.

What is the use of Ctools module?
Ans: This suite is primarily a set of APIs and tools to improve the developer experience. It also contains a module called the Page Manager whose job is to manage pages. In particular it manages panel pages, but as it grows it will be able to manage far more than just Panels.

For Drupal module development code review which module can be used?
Ans: Use the the coder moduble

Which Drush commands you use while development?
Ans: Following drush commands are use useful while development.
Drush cc – clear cache
pm-disable (dis) Disable one or more extensions (modules or themes).
pm-download (dl) Download projects from drupal.org or other sources.
pm-enable (en) Enable one or more extensions (modules or themes).
pm-info (pmi) Show detailed info for one or more extensions (modules or themes).
pm-list (pml) Show a list of available extensions (modules and themes).
pm-refresh (rf) Refresh update status information.
pm-releasenotes Print release notes for given projects.
(rln)
pm-releases (rl) Print release information for given projects.
pm-uninstall Uninstall one or more modules.
pm-update (up) Update Drupal core and contrib projects and apply any pending database updates (Same as pm-updatecode + updatedb).
pm-updatecode (upc) Update Drupal core and contrib projects to latest recommended releases.

For better search what we can do in Drupal 7?
Ans: Use the Solr module

How can Improve the Drupal cache and logging?
Ans: Use the Mongodb module

Add a Comment

Your email address will not be published. Required fields are marked *