Hello Guys, Here I am sharing some interview questions based on my experience having with Globant for Drupal skill.

Most of the questions comes up with your past experience on projects which you worked on.

  • Difference b/w D6 & 7.
  • Migration api
  • Custom migration class
  • Fields mapping
  • Panels & panalizer
  • Custom pane
  • Migration form other CMS to Drupal
  • SEO
  • Server optimization
  • Caching mechanism
  • Apache solr
  • Rest api & web services
  • Most usable hooks
  • Things which you keep in your mind while creating any custom module or theme
  • How different is drupal with other CMS like wordpress & Joomla
  • Simple saml php
  • SSO integration
  • Facebook/Google api
  • Views/Features/Crons
  • Subthemes
  • Breakpoints and pillars in theme

Environment setup / Module implementation related questions

1Have you ever used Drupal VM or Acquia site factory enviornment?

Answer :  Yes.

Drupal VM makes building local Drupal development environments quick and easy, and introduces developers to the wonderful world of Drupal development on local virtual machines (instead of crufty old MAMP/WAMP-based development).

It will install the following on an Ubuntu 16.04 (by default) linux VM:

Apache, Php, Mysql, Drupal 7 or 8, Drush 7 or 8

Optional:

  • Drupal Console
  • Drush
  • Varnish
  • Apache Solr
  • Elasticsearch
  • Node.js
  • Selenium (for Behat testing)
  • Ruby
  • Memcached
  • Redis
  • SQLite
  • Blackfire
  • Tideways
  • XHProf
  • XDebug
  • Adminer
  • Pimp my Log
  • MailHog

2What is Vagrant and use of it?

Answer : Provisioners are tools that allow users to customize the configuration of virtual environments. Vagrant uses to set up and create virtual environments.

We have following command to set up/ configure virtual machine.

  • Vagrant up : This command creates and configures guest machines according to your Vagrantfile. This is the single most important command in Vagrant, since it is how any Vagrant machine is created. Anyone using Vagrant must use this command on a day-to-day basis.
  • Vagrant provision : Runs any configured provisioners against the running Vagrant managed machine.This command is a great way to quickly test any provisioners, and is especially useful for incremental development of shell scripts, Chef cookbooks, or Puppet modules. You can just make simple modifications to the provisioning scripts on your machine, run a vagrant provision, and check for the desired results. Rinse and repeat.
  • Vagrant ssh : This will SSH into a running Vagrant machine and give you access to a shell.If a -- (two hyphens) are found on the command line, any arguments after this are passed directly into the sshexecutable. This allows you to pass any arbitrary commands to do things such as reverse tunneling down into the sshprogram. we can easily connect with Drupal vm using this command.
  • Vagrant destroy : This is used to destroy existing VM.

3What is Ansible?

Answer : Ansible is an open source automation platform. Ansible can help you with configuration management, application deployment, task automation. It can also do IT orchestration, where you have to run tasks in sequence and create a chain of events which must happen on several different servers or devices.

An example is if you have a group of web servers behind a load balancer. Ansible can upgrade the web servers one at a time and while upgrading it can remove the current web server from the load balancer and disable it in your Nagios monitoring system. So in short you can handle complex tasks with a tool which is easy to use.

Unlike Puppet or Chef it doesn’t use an agent on the remote host. Instead Ansible uses SSH which is assumed to be installed on all the systems you want to manage. Also it’s written in Python which needs to be installed on the remote host. This means that you don’t have to setup a client server environment before using Ansible, you can just run it from any of your machines and from the clients point of view there is no knowledge of any Ansible server (you can run Puppet in standalone mode, but Puppet still needs to be installed). There are some other requirements though, for example if you want to do something related to git on a remote machine a git package must first be installed on the remote machine.

Ansible is available for free and runs on Linux, Mac or BSD.

Once you have installed Ansible and added some hosts to the inventory file, typically /etc/ansible/hosts you can try to connect to your hosts. By default a connection will be made with ssh keys, but you can also specify a username and password.

A good first test is just to see if you can connect to your devices with the ping module.

ansible all -m ping

The “all” keyword is for all of the hosts in your inventory, to only target hosts in a specific group you enter the group name instead of all.


4What is vagrant box and hostupdator?

Answer : Boxes are the package format for Vagrant environments. A box can be used by anyone on any platform that Vagrant supports to bring up an identical working environment. The vagrant box utility provides all the functionality for managing boxes.

Vagrant::Hostsupdater. This plugin adds an entry to your /etc/hosts file on the host system. On up, resume and reload commands, it tries to add the information, if it does not already exist in your hosts file. If it needs to be added, you will be asked for an administrator password, since it uses sudo to edit the file.

 


5What is nfs in linux?

Answer : The Network File System (NFS) is a way of mounting Linux discs/directories over a network. An NFS server can export one or more directories that can be mounted on a remote Linux machine. if you need to mount a Linux filesystem on a Windows machine, you need to use Samba/CIFS instead of NFS.

 


6What is singleton?

Answer : A singleton object is an object that is only instantiated once. That is not the same as the Singleton Pattern,  that can be only instantiated once, the Singleton “Ensure a class has only one instance, and provide a global point of access to it. Mostly uses in thread system like ticket reservation.

 


7What is PHAR?

Answer : Phar archives are similar in concept to Java JAR archives, but are tailored to the needs and to the flexibility of PHP applications. A Phar archive is used to distribute a complete PHP application or library in a single file.


8We need to implement autoloader/Infinityscroll in drupal, how you will proceed with custom module (don’t need any contrib module)

Answer : First of all we will create a page using view or menu callback which will render 30-40 contents.

If it is a view I can add the js, css directly using hook_preprocess_page or THEME_preprocess_views_view.

If I create a custom menu call back then will define the hook_theme function and create my own template file to render the output using theme() function which I can use any where. I can add the js on that template file.

Creating the JS file : I will create js file under module_name/js folder, in which I can add the drupal behavior for InfiniteScroll and call the infinitescroll event of jquery plugin with using the selector of 10 contents.

Drupal behaviors handles infinite scroll’s AJAX call, since it has the ability to override or extend an existing behavior by a bouncing effect where it is an alternate for jQuery.ready. It can be reattached and you can attach behaviors to a specific context.

 


9Why we use Drupal behavior?

Answer : In short, the advantage of Behaviors over document.ready() is that they are automatically re-applied to any content loaded through AJAX. mymodule is your namespace, which needs to be unique. context is the part of the page for which this applies, for example a part of a form that has been updated with AJAX. You can attach multiple behaviors, but I think you need to use a unique name (mymodule) for each of those.

 

10Related