Drupal Interview Questions And Answers – 3

A list of top frequently asked Drupal interview questions and answers Part-3 are given below. Drupal jobs interview questions and answers page designed by our professionals help you to overcome interview fear and to successfully clear it.

101. How to use preprocess function?
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.

102. Explain hooks in Drupal.
Hooks are Drupal API code which allows module to interact with Drupal core. Its module system is based on the hooks concept.

103. How to interact with Drupal search systems?
There are three ways to interact with Drupal search system by implementing:
o nodeapi (update index)
o hook_search()
o hook_update_index()

104. Explain the use of Sections module in Drupal.
The Sections module allows applying different themes to different pages in a Drupal site.

105. What is Drupal error handling?
Error Handling is a process of detection and finding the resolutions for the errors, this can be programming application errors or communicable errors.

106. What is Drupal Pane module?
Pane module is used to translate the custom panel’s pane with optional title that will be stored as variables and it can be translate or edit quickly.

107. What is aggregator module?
Aggregator Module takes the content from other websites but does not generate any feeds. It is also known as a feed reader. It gathers, displays texts and images and other sites and blogs.

108. What is the use of Length of trimmed description field in Feed aggregator?
Select the length of your descriptions.

109. What is the use of auto-reply field in contact module?
Sends the automatic reply message to the user.

110. What is the use of Product SKU while setting shopping cart?
Unique identifier for the product is given here.

111. What is the use of Rate field while setting up taxes?
It is a percentage used to calculate the tax which is expressed as a decimal.

112. What is the use of Tax amount rounding mode field while setting discounts?
Specify what type of rounding should occur when tax rates of tax type are calculated for the unit price of a line item.

113. What is the use of Add to Cart Form Settings field in receive donation?
It includes the product line item types in add to cart form to collect information.

114. What is the use of server field in setup payments?
We should select the server from either of the one i.e. Production or Sandbox.

115. What is Drupal invoice generation?
Invoice is a document with a statement of amount and cost, unique invoice number and tax information.

116. What is Drupal order history?
Order history is dependent on the ordered products made by the user through the use of checkout. It includes history of the product which includes order number, user name, order status etc.

117. What is the use of order status field in product order history?
It defines the order status such as processing or pending or completed or cancelled.

118. What modules do you always recommend and why?
• Views – This module is essential in every website I build. It makes displaying lists of content very easy. If you want an image slideshow, a list of blog posts, a list of products, etc., views is the best place to start.
• Panels – Panels gives you the ability to create custom pages easily. These custom pages can have multiple regions of content. For example, you may want to create a home page that has a Slideshow on the top, and a two column layout below.
• Ctools – On its own, Ctools does not seem to do a lot. However, it is actually a very powerful framework if you begin developing your own modules. I have used Ctools in the past for developing multi-step forms, modal dialog boxes, and even multi-step forms inside of modal dialog boxes.
• Token – Tokens are little snippets of text that can be used as replacement patterns. For example, if your website sends out emails and you want to add in the users name, or you want fill in a link path with a node id to provide a helpful link to content, tokens will save the day.
• Pathauto – The Pathauto module is a necessity for any website that frequently adds new content. It is also especially important if you have a website that allows users to create content using content types. Pathauto simplifies creating clean and search engine friendly URLS for the various content you add to your site.
• Webform – If you want to provide easy to fill out forms for the visitors of your site, the Webform module will help you out.
• Rules – Drupal rules will allow you to set up condition actions.
• Date – This is useful for allowing the easy selections of dates in content types (with a nice date popup). It also integrates nicely with the views module.
• Quicktabs – Makes it easy to add tabbed content without having to write your own Javascript/Jquery. What more do I have to say?
• Libraries – Makes organizing your various libraries of functionality easy (see Jquery UI above for an example). Google Analytics – I don’t build a Drupal website without adding Google Analytics. This module makes it very simple. What gets measured, gets improved after all.

119. How to enable jQuery in Drupal?
To install JQuery in Drupal, follow these steps carefully:
• Start with downloading the jquery_ui Drupal module by using the stable version available (6.x-1.5). Now, move it to your modules folder (e.g. sites/all/modules/jquery_ui)
• Now, go to the jQuery UI and then download the “Legacy” 1.7.x version. Not the 1.8.x version or any other later branch!
• After completing the above step, inside a temporary directory, extract the directory “development-bundle” collected from the archive and finally rename it to “jquery.ui”.
• After renaming, start copying the renamed directory, (jquery.ui) into the sites/all/libraries folder (create a separate folder like this if it should look like sites/all/libraries/jquery.ui.)
• Finally activate the jquery_ui module in Drupal version 8.

120. How do you enable twig to debug in Drupal 8?
While there are many methods to enable Twig Debug, this is one of the easiest and simple way
• Step 1: Navigate to the \sites\default in the Drupal 8 dashboard.
Step 2: Now, start the process by making a copy of the default.services.yml file and renaming it to services.yml (if services.yml does not already exist).
• Step 3: Next, open the file and search for this phrase ‘twig.config’.
• Step 4: Once you’ve got the phrase, set the debug mode to true, auto_reload mode to true and cache to false mode.
• Step 5: Finally, go to the bottom of the file and copy the following code block as it is:
Parameters
twig.config:
debug: true

121. How to create a new theme in Drupal 8?
To create a theme in Drupal 8 from scratch, use the following steps:
• Create a theme folder inside Drupal 8 to store your theme in a .info.yml file and libraries file.
• Create the .info.yml file
• Create the .libraries.yml file.
• Start creating the stylesheets
• Now, create designs and then, you have your own theme in Drupal 8.

122. How to insert form data into the database in drupal 8?
Here is a code to insert data from the form to the table in a database in Drupal 8
Example

public function submitForm(array &$form, FormStateInterface $form_state) {

$field = $form_state->getValues();

$name = $field['name'];

$email = $field['email'];

$field_arr = [

'name' => $name,

'email' => $email

];

$query = \Drupal::database();

$query->insert('users')

->fields($field_arr)

->execute();

drupal_set_message("data successfully saved");

}

 

123. How to create rest API of tab in drupal 8?
To successfully enable a REST API tab in Drupal 8, follow these steps:
• Download and install the REST UI contributed module.
• Now, expose the view data as rest export using Rest UI
• Now, create a CSRF token for completing basic authentication procedures.
• Now, submit files to the node using the REST API

124. how to improve DRUPAL performance for anonymous and authenticated users ?
• Anonymous Traffic: Lighter user, basic configuration and performance tuning should handle more use cases.
• Authenticated Traffic: Heavier user, can lead to more complex configurations to handle load and performance.

125. Explain the capabilities of views module.
The Views module provides a flexible method for Drupal site designers to control how lists and tables of content (nodes in Views 1, almost anything in Views 2) are presented. Traditionally, Drupal has hard-coded most of this, particularly in how taxonomy and tracker lists are formatted. This tool is essentially a smart query builder that, given enough information, can build the proper query, execute it, and display the results. It has four modes, plus a special mode, and provides an impressive amount of functionality from these modes.
Among other things, Views can be used to generate reports, create summaries, and display collections of images and other content.

126. What are the technical differences between Joomla and Drupal?
• Joomla only supports one Section and one Category for each content, while you can assign Drupal contents to several Sections/Categories.
• Joomla does not support multi-site setups, whereas drupal supports multisite setups.
• Drupal has built-in forum discussion, so you don\’t need to install additional modules.
• The term Blog in Joomla is not same as blog in Internet dictionary. ‘Blog’ term in Joomla is actually a teaser view of contents containing: Title, Introduction and a Read More link. So, in short, ‘Blog’ in Joomla terminology is not ‘Weblog’! If one is asking if Joomla supports a ‘Blog’ by default, then the answer is yes, but with a different meaning.
• Comments on contents are not available in Joomla by default, but Drupal supports comments for all content-types by default.

127. Do you keep regular backups?
We should have automated backups running for the database (most important), code, files and server at least once a day (hourly is better).

128. What is drupal panels?
The drupalpanels is a module in drupal which allows a drupal website 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.

129. What is drupal cache?
The core Drupal cache stores assembled pages and blocks for anonymous visitors in the cache tables in the database. Other popular Drupal caching options include boost,memcache, and authcache.

130. What is critical path?
The code that is run when serving a cached page.

131. What is triage?
A new bug or issue is assigned a priority based on its severity, frequency, risk and other predetermined factors, borrowed from medical term triage.

132. Can Drupal work with JavaScript?
Drupal provides methods for implementing JavaScript. Using these methods will help to keep your code clean and to ensure compatibility with the way other modules implement JavaScript.
A couple of simple principles guide Drupal’s JavaScript approach: – All pages should be perfectly functional without scripts. JavaScript provides alternatives or supplements, not replacements for standard elements. – No JavaScript is hard-coded into pages. Rather, actions are attached dynamically to page elements–and only if the needed JavaScript support is present.

133. Explain the flow of information between the 5 main layers of Drupal?
Every element of information is called node. At the base of the system is the data pool which is the collection of nodes. Next are the modules that are functional plug-ins. Modules may be drupal core or a contributed item. Blocks and menus form the next layer of drupal. Blocks are output tool. A user can configure blocks to create a display that he wants and show only a few pages. In the next layer, user permissions are determined to the type of users who would be allowed to work on the database. Template, which is the theme of the site, is the last layer. It is made of a combination of XHTML, CSS and PHP.

134. Can you comment on the Scalability factor of Drupal?
There are many Drupal websites which are maintained with over millions of views every day. Drupal has grown very much towards the optimization factor and Drupal is easily scalable across higher bandwidths with efficient and stable platform for management.

135. Explain coding standards in Drupal?
As per the Coding standards, omit the closing ?> tag. Including the closing tag may cause strange runtime issues on certain server setups. (Note that the examples in the handbook will show the closing tag for formatting reasons only and you should not include it in your real code.)
All functions in your module that will be used by Drupal are named {modulename}_{hook}, where “hook” is a pre-defined function name suffix. Drupal will call these functions to get specific data, so having these well-defined names means Drupal knows where to look. We will come to hooks in a while.

136. How to install a new module in Drupal?
After finding and downloading a module, the next step would be to copy it the modules folder. Most people copy the file to the default modules folder here http://sitename.com/drupal/modules this is where all the modules that ship with Drupal are stored so it seems somewhat logical to do this. But this folder is actually meant to store only Drupal’s default modules. Instead you should go to http://sitename.com/drupal/sites/all folder, there you will see a readme.txt file. This file will clearly tell you the trick. You just need to create a new folder named modules here. Now copy the modules folder here. That’s all, you have successfully installed the module.
Next step would be to enable the module through the Admin interface. To do this navigate to Administer Site Building Modules. Here you will see a list off all installed modules, and our newly installed module will also be listed here. You just have to check the enable check box against the new module and then click the Save Configuration button. That’s all.

137. Can Drupal run on command line?
Yes. Drupal can run on command line by using DRUSH.

138. Explain DRUSH, Drupal weight, and Drupal Cron briefly?
DRUSHis a UNIX scripting interface for Drupal. It is command line shell. It is mainly helpful for those who are mainly worked on command line tools only.
Drupal weight tells the priority or order to process the particular function and display of the block or node.
Drupal Cron is used to executing the commands or scripts automatically at a particular date and time intervals.

139. Is it possible to disable a core required modules through Drupal admin?
No. It is not possible to disable a core required module through Drupal admin.

140. Which Are The Core Required Modules In Drupal 6.x ?
1. Block — Controls the boxes that are displayed around the main content.
2. Filter — Handles the filtering of content in preparation for display.
3. Node — Allows content to be submitted to the site and displayed on pages.
4. System — Handles general site configuration for administrators.
5. User — Manages the user registration and login system.

141. Which Are The Core Optional Modules In Drupal 6.x ?
1. Aggregator Aggregates syndicated content (RSS, RDF, and Atom feeds).
2. Blog Enables keeping easily and regularly updated user web pages or blogs.
3. Blog API Allows users to post content using applications that support XML-RPC blog APIs.
4. Book Allows users to structure site pages in a hierarchy or outline.
5. Color Allows the user to change the color scheme of certain themes.
6. Comment Allows users to comment on and discuss published content.
7. Contact Enables the use of both personal and site-wide contact forms.
8. Content translation Allows content to be translated into different languages.
9. Database logging Logs and records system events to the database.
10. Forum Enables threaded discussions about general topics.
11. Help Manages the display of online help.
12. Locale Adds language handling functionality and enables the translation of the user interface to languages other than English.
13. Menu Allows administrators to customize the site navigation menu.
14. OpenID Allows users to log into your site using OpenID.
15. Path Allows users to rename URLs.
16. PHP filter Allows embedded PHP code/snippets to be evaluated.
17. Ping Alerts other sites when your site has been updated.
18. Poll Allows your site to capture votes on different topics in the form of multiple choice questions.
19. Profile Supports configurable user profiles.
20. Search Enables site-wide keyword searching.
21. Statistics Logs access statistics for your site.
22. Syslog Logs and records system events to syslog.
23. Taxonomy Enables the categorization of content.
24. Throttle Handles the auto-throttling mechanism, to control site congestion.
25. Tracker Enables tracking of recent posts for users.
26. Trigger Enables actions to be fired on certain system events, such as when new content is created.
27. Update status Checks the status of available updates for Drupal and your installed modules and themes.
28. Upload Allows users to upload and attach files to content.

142. Explain Updating Drupal?
There are two different “magnitudes” of upgrades. There are major upgrades and minor updates. A major upgrade updates Drupal from one major version. Because major Drupal versions indicate substantial changes, such upgrades are often time consuming, requiring many steps both before and after the actual installation of the software.
Minor updates move from one point release to another newer point release. A point release is a software update that contains only bug fixes and minor feature changes. Its major version number remains the same, but its minor version (its point number) is incremented.
Drupal’s current major version number is 7, and its minor version number (as of time of writing) is 12, so we have version 7.12. Updating minor releases is much simpler than major upgrades, and should also be done regularly. Since most minor versions are released for security or stability reasons, they are typically quite important. In this section, we will look at updating Drupal multi-site configurations. The process differs from upgrading a single-site instance in that there are more steps, and the order of steps must be done carefully. Since a multi-site runs only one copy of Drupal, all of the sites on a multi-site install must be updated at the same time. Multi-site updates differ from single-site updates in one crucial way: while Drupal’s code needs to be updated only once, each individual site needs to go through the updating process. To keep site impact to a minimum (and to avoid catastrophes), doing these updates requires a special process.

143. How To Fetch A New Version Of Drupal?
You can use your web browser to go to Drupal.org and download the newest version, or you can use any number of tools to do this for you. For example, you can use Drush, if you have it installed and configured in the Vagrant profile).

144. What Are GNU Licenses ?
Not at all—there are many other free software licenses. We have an incomplete list. Any license that provides the user certain specific freedoms is a free software license.

145. What Is Difference Between Diff And Patch?
diff creates patch In simple terms, the diff command is used to compare differences between two versions of a file. The resulting file is called a patch, and typically is given (by the user) a “.patch” suffix.
This patch file then can be used on other copies of the “old” file by using the patch command, thus updating their “old” file(s) to match the “new” file(s).
Why you would use diff When might one use diff to create a patch file? Let’s say you are customizing a module to fix a bug, and have saved a new version of the module. How will you pass on your bug fix to others? Simply passing on your version of the module may not work, because it’s quite possible someone else has modified some other aspect of the code at the same time and you both would be overwriting each others’ changes.
So instead, what you do is run diff between the two files, and then upload the resulting patch — which others can then apply to their files using the patch command. (And you can apply other people’s patches against your files, without losing your own changes.).
The added benefit of this type of workflow is that changes to the code can easily be tracked — and undone, if necessary — which is essential in a community-developed project such as Drupal.

146. What is difference between innodb and myIsam?
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.

147. What is difference between update and alter query?
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.

148. What is Multilingual content?
Multilingual means your content can be written and will be displayed in different languages.

Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.
Subscribe Here (or)

Leave a Reply

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


eight − 7 =

Popup Dialog Box Powered By : XYZScripts.com
  • RSS
  • Facebook
  • Google+
  • Twitter