Drupal Interview Questions and Answers : 10 commonly asked questions [2]

Drupal CMS

Hope you find the Drupal interview Questions and Answers very helpful. Continue on reading next 5 Questions and don’t forget to share this page with your friends.

7. How database system of Drupal works ?

In Drupal, each type of information has its own database table. For instance, the basic information about the nodes of your site are stored in the Node table, Comments and Users also have their own database tables, and roles, permissions, and other settings are also stored in database tables.

READHow to use Drush with Drupal : Drush Tutorial to update Drupal

READ : PHP Interview Questions and Answers

READ : jQuery Interview Questions and Answers

8. What is Database abstraction layer in Drupal ?

Allow the use of different database servers using the same code base.
Drupal provides  an abstraction layer  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, while letting Drupal control the pieces of queries that need to be written differently for different servers and provide basic security checks.

Most Drupal database queries are performed by a call to db_query() or db_query_range(). Module authors should also consider using pager_query() for queries that return results that need to be presented on multiple pages, and tablesort_sql() for generating appropriate queries for sortable tables.

9. How do you handle upgrades?

Steps to Upgrade drupal minor version.

  • backing up the site,
  • putting it into maintenance mode
  • downloading the new version of the module
  • uncompressing it
  • running update.php
  • testing the site
  • taking the site out of maintenance mode

Steps to Upgrade Drupal major version.

  • Backup your existing site and database.
  • Log in as user ID 1
  • Put your site in maintenance mode
  • Change all themes to Garland
  • Disable non-core modules
  • Remove default settings file
  • Remove all old core files and directories
  • Remove uninstalled modules
  • Download Drupal 7
  • Re-apply modifications to core files
  • Make your settings.php file writeable
  • Run the update script
  • Backup your database
  • Upgrade fields
  • Update contrib modules and themes
  • Check the Status Report
  • Make sure settings.php is secure
  • Check Drupal Core Modules
  • Remove your site from Maintenance Mode

10. How to debug code in Drupal?

Simple using print_r or var_export , you can debug code within Drupal.

<?php
$node = node_load(123);
print_r($node);
?>

Drupal devel module provides dsm and dpm functions to debug code within drupal.
<?php
$node = node_load(123);
dpm($node);?>

Drupal latest version provides debug inbuilt function to print errors, notices and warnings as well.This could be in the page or in the logs depending on how php is configured.

For example,
<?php
$node = node_load(123);
debug($node);
?>

The full options for debug function are:
debug($data, $label, $print_r);

The $data is pretty self explanatory. It can be anything you could pass through print_r or var_export. The $label allows for a custom label to be added. This is ideal when you are sending the information to a log and you want a key to search the logs for. The 3rd argument is whether to use print_r or var_export. The default is var_export. If you are interested between the two I’d suggest reading the manual pages.

READ : JavaScript Interview Questions and Answers

READ : Most Commonly asked 10 HTML5 interview questions and answers

Read Previous Questions