Top Interview Questions and Answers

Top Interview Questions and Answers
Interview Sortout

Browsing "Older Posts"

Top jQuery Interview Questions and Answers

By Dhananjay yadav → March 26, 2018
What is jQuery?
jQuery is a Javascript library which uses usage of Javascript very easy.We can handle events, manage CSS properties, DOM element, animation and many more utilities using jQuery library.It is an opensource. It is used by Microsoft, Google, IBM and almost the big players in software industries.

What are selectors?
jQuery selectors are the tool to identify the HTML elements and to manipulate properties. for example:
$(".name") : Class selector
$('#logo') : ID selector
$("button") : tag selector
$(this) : current dom selector

What are the selectors that we use in jQuery?
We use the following selectors in jQuery:
-Tag
-Class
-Id
-all (*)
We can derive more selectors using these main selectors.

What is an event?
An event is a user action. When a user interacts using UI it has to make many clicks, drag, drop, mouse over, change drop down, keypress actions, these actions are recognized by jQuery.

What are the common events that user make?
Most common events make by users are :
-click
-mouseover
-keypress
-keydown
-change
-input
-drag
-drop
-blur
-dblclick (double click)
-mouseenter


What is toggle()?
toggle() is a function which provides switching functionality between two actions, functions, properties etc. Suppose we can show and hide an element using toggle function.

What is callback?
A callback is a function which is called after when execution finished. We have to specify which function we have to call after a particular execution.

What is alert()?
alert() is used as a callback to show some warning, notification or error.

$("button").click(function(){
        alert("Clicked on button");
});

What is chaining in jQuery?
Chaining is calling of multiple functions in a single statement. for example :
$(".button").css("color", "#ececec").slideUp(1000).slideDown(2000).hide();

How to get value or text of an HTML element?
Since we know jQuery can manipulate HTML DOM, we can use functions to get value, text or html block inside an HTML element. For example

$('.first_name').val();  //geting value in input box having class as first_name

$('p').html();   //getting html inside a 'p' tag

$('textarea').text();  //getting text inside a textarea


How can we set values or HTML element?
very similar to getting the value, we can set values to elements. For example:

$('.first_name').val('Interview Sortout Blogs');  //geting value in input box having class as first_name

$('p').html('My blog is based on interview');   //getting html inside a 'p' tag

$('textarea').text('This blog is awesome. You are doing a verygood job,Interview Sortout');  //getting text inside a textarea


How to add or remove class from a HTML element?
jQuery have functions to add or to remove classes from an HTML elements. Please see the following examples:

$('button').addClass('btn-danger');
$('button').removeClass('btn-danger');


How to check that an element has a class?
We can use function hasClass().If class found it returns true, other wise returns false.

if($('button').hasClass('btn-danger')){
 alert('Button class is btn-danger');
}


What append() and prepend() functions do?
append() function , adds an HTML block after(at the end) a selector. For example :
$('p').append('Interview Sortout');

prepend() method, adds a block before or at the beginning of the selector. Example:

$('p').prepend('

Interview Sortout

');

What does parent() method do?
parent() method select the direct parent or immediate ancestor that is next to selector.

What does parents() method do?
parents() select all ancestors , the elements including parent of parent.

What childre() do?
children() method select the immediate child of the selector.

What does find() method do?
find() method search for the selector passed and selects from all the children of selector.

What does siblings() method do?
sibling() method returns all the elements having parralle relationship with selector. We can call them siblings.

How to call AJAX in jQuery?
An AJAX call example in jQuery:

var $post = $.ajax({
  url: "example.php",
  type: "POST",
  data: {id : product_id, product_name:product_name},
  dataType: "json"
});

$post.done(function(msg) {
  $("#log").html( msg );
});

$post.fail(function() {
  alert( "Request failed: Request Has been failed" );
});


More Java Script Related Interview questions and answers
  1. JSON Interview Questions and Answers
  2. Basic Java Script Interview Questions and Answers

Drupal Interview Questions and Answers

By Dhananjay yadav →

What is Drupal?
Drupal is an open source Content Management System and used for Complex websites. It has great flexibility of functionality and modularity. We can design our website using the core of Drupal and we can manage content on pages easily. Nowadays Drupal is used for e-commerce stores, blogging, business sites, college and universities websites.

What are the main features of Drupal?
Main features of Drupal are listed as:
-Open Source
-Flexible and Robust CMS in comparison to Others.
-Provide Security layer.
-Easy to manage Content.
-Fields and Blocks that are the most flexible assets of Drupal.

How Drupal is different from other CMSs available as opensource?
Drupal has a complex structure, and a heavy core so it is not suitable for small websites. It is secure than any other CMS.It has a great functionality to manage content and visibility. It provides a robust user management module in core.

What is the .info file in a Drupal theme?
This is the configuration setting of the Drupal theme. A .info file is a static content and settings are written here as key=value format. Each line has a different key and value for that. Metadata, style sheets, JavaScripts, block regions and more can be defined here. It is used for theme and not for the module.

What is a theme?
The theme is a collection of files to construct the layout. A Drupal theme contains following important elements:
- Configuration file (.info)
- Templates file (.tpl.php)
- Stylesheets
- sub-themes

What is Module in Drupal?
A module in Drupal is a collection of PHP files to provide some additional functionality to Drupal site. A module can access all the core functions and variables of the Drupal.

What is Block?
Blocks are the layout elements. A block defines that what particular content should be displayed at what place in the layout. It is a box in the content area.

How can we add modules to the core?
We can upload compressed files of the module or we can directly import from the remote URL.

What are the regions?
Regions are the layers defined by theme to represent the content area. For example footer, sidebar, navigation etc.

What is a node?
All the contents are treated as a node in Drupal. A node is a chunk of content. We create content, custom content using node module.

What is taxonomy?
Taxonomy is used to organize Metadata, tags, categories in Drupal. It a feature of Drupal core. It is used to categorize the content of the website. We can use tags to connect the content.

What is sub-theme?
A sub-theme is child theme. It inherits the resources of the Parent theme. It can be chained. A sub-theme can be a child of another sub-theme. All the styles sheets and javascript inherited by sub-theme.

What is service.yml?
service.yml placed in the root directory in and all the services are defined here.

What are properties of services?
Services may have following properties:
-abstract
-alias
-tag
-arguments
-calls
-class
-factory
-file
-public
-scope

What is settings.php?
This is the global settings of the site.Tthe database, URL structure, salt, encryption etc all the variables are defined here.

What is clean URL?
SEO friendly URLs in Drupal is clean URL.We can enable or disable it.

How can we manage clean URL in Drupal?
We can enable or disable clean URLs by following steps:
-navigate to Administer > Configuration > Search and metadata > Clean URLs
-Wait for the automated Clean URLs test to run.
-Check or uncheck the Enable clean URLs checkbox
-Click "Save configuration"

What is URL alias?
We can add our custom URL in place of "node". It makes URL clean and SEO friendly.

What does cron do in Drupal?
Cron deletes temporary files and trigger the search module to index the content on the site.It pings modules to get updates.

What is Report in Drupal?
Reports modules collect the site health report and logs.It does the following task:
-Recent log entries
-Top 'access denied' errors
-Top 'page not found' error
-Available updates
-Status Report
-Site statistics

What is the status report?
Here you can find a short overview of your site's parameters as well as any problems detected with your installation.

What is Recent Log entries?
The Database Logging module logs system events in the Drupal database. Monitor your site or debug site problems on this page.

What are the content types in Drupal?
Contents are categorized into 2 basic categories:
1- Basic pages
2- Articles

What is Basic page content?
Basic Page is the landing pages for a site, that rarely change. If we are creating About us, Contact us, Services, Team pages then we have to choose Basic Page type content.

What is Article type content?
Article type is a regular blog post on the site. We can select Article if we are writing an article or blog posts related to latest updates, hobbies etc.


20 Android Interview Questions and Answers : Basic Level

By Dhananjay yadav → March 24, 2018
Android Interview Questions and Answers

What is Android?
Android is an operating system based on a modified version of Linux kernel and other open source software which was developed by Google and later the Open Handset Alliance (OHA). Contrary to what most of the people think, Android is not a programming language. In other words, Android is an open source operating system used for devices like smartphones and tablet computers.

What are the components of Android application?
  • Activities:
  • Intent
  • Services
  • Broadcast receiver
  • Content providers


What languages do android support?
Android system most commonly uses JAVA language, though the native C/C++ can also be used to write a program in android.

How Androidpes of Android applications are there?
There are two types of Android applications, namely:
a) Hybrid Applications
b) Native Applications

Who is the founder of android?
Android was invented by Andy Rubin, Rich Miner, Nick Sears and Chris White in the year 2003 in Paolo Alto, California.

What do you understand by the term APK?
APK stands for Android Package, an APK file can be installed on an android device just like installing software on windows. APK files are kind of archive files, to make an APK file an android program is compiled and then all its contents like assets, resources, and certificates are packaged into one file.


What is AAPT?
AAPT stands for Android Asset Packaging Tool, it is a tool that provides developers the ability to deal with zip-compatible archives including creating, extracting and viewing the contents.

Give some disadvantages of Android OS?
Android is categorized a heavy operating system and most apps tend to run in the background even when not in use.
High power consumption rate is inherent to Android-powered devices.
Android is not considered among the safest types of OS and is prone to malware.
High data consumption due to background running of applications.

What are the essential items in an Android application?
Following are the essential items for an android application:
  • AndroidManifest.xml
  • build.xml
  • bin/
  • src/
  • res/
  • assets/


What is Android Studio?
Android Studio is the primary IDE for native Android application management. It is the official Integrated Development Environment for Google’s Android operating system.

What is the earliest version of Android?

The earliest version of Android was, “Android 1.0” and it was released on September 23, 2008.

What is ANR?
ANR is the short form for Application Not Responding; it is a dialogue that appears when an application has been unresponsive for a long period of time. If we run a big application on an OS in main thread we won’t be able to get responses back, so at this point, ANR is displayed.

Which database is used in Android?
Android system uses SQLite database; it is an open source, a lightweight relational database for mobile devices. It is inbuilt in the Android system by default, so one doesn’t need to perform any database setup or administration task.

Give some advantages of Android?

Listed below are the advantages of the Android operating system:
Ease of notification.
Ease of access to several applications
Modified ROMs can be flashed to android devices.
Multitasking is an added benefit.
Multiple language support.


What is activity?
The building block of the user interface is defined as an activity. Activity is a predefined class in Android all the applications which have the user interface (UI0 must inherit it. In other words, we can also define it as a Java code that supports a screen or UI. Activities are central to how a user navigates within an application while serving as an entry point for user’s interaction with an Android application.

What is Android Architecture?
The key components that constitute android architecture are given below:
Linux kernel
Libraries
Android framework
Android Applications

Define Intents.
The intent in an android system can be defined as a notification to the user or developer from within the Android-powered device that is used to alert him/her of a particular state that occurred so that the user can respond to it in a required manner.

What do you mean by AIDL?
AIDL: Android Interface Definition Language is used to handle interface requirements between a client and service so as to accommodate the same level of communication through IPC ( Inter Process Communication).The objects are broken down into primitives that android can understand.

What is Content Provider used for?
A content provider is part of an android system application which is used to provide a way to share data with other applications. In other words, it can be said that content provider manages the access to a repository of data.

What is the use of Android SDK?
Android SDK or Android Software development Kit is used for writing programs. SDK offers comprehensive tools for development of Android applications, some of which are; debugger, libraries, sample code, tutorials, etc. SDK also supports older android versions.

TOP 10 : MySQL Database Interview Questions For Experienced

By Dhananjay yadav → March 22, 2018
MySQL Database Interview Questions For Experienced

What are the storage engines used by MySQL?
Storage engines supported by MySQL are as follows:
  1. InnoDB
  2. MyISAM
  3. Memory
  4. CSV
  5. Merge
  6. Archive
  7. Federated
  8. Blackhole
Which one is the default storage Engine in MySQL?
The default engine is InnoDB.

What is a database engine?
Database Engine is the basic building blocks of storage systems , used by Database Management Systems to run CRUD (INSERT,SELECT,UPDATE,DELETE)instructions.

What is difference between InnoDB and MyISAM?
InnoDB is featured with ACID propety of transactions, but MyISAM does not support transaction. MyISAM supports FULLTEXT search index where as InnoDB does not.

What are HEAP tables in MySQL?
HEAP tables are the existing tables in memory.They also known as memory tables and use Indexes instead of BLOB and TEXt.

What are Stored Procedures in MySQL?
Stored Procedure is Batch of SQL statements and saved in database. It also accepts parameters and can be triggered explicitly. It improves the traffic control and gives a modular structure to implement maintainability.

CREATE PROCEDURE show_employee

AS

    SELECT FirstName, LastName

    FROM employee;

EXEC show_employee;

What is Trigger?
Auto executable sets of SQL statements stored in database are known as Triggers. They are fired when some event CRUD event occurs.When we do some CRUD operations on table the trigger linked with that table fires. Trigger is behaves like a stored procedure but it invoked automatically. It adds a layer of security in database.

What are differences between Trigger and Stored Procedure?

We can execute procedure explicitly whenever we would like , but trigger can only be invoked on an event fire.We can call a Procedure inside another Procedure but we can not invoke a trigger directly inside another trigger. We can use trigger for transaction purpose but we can not use procedure for transactions.

What are the CONSTRAINTs in MySQL?
MySQL CONSTRAINTs used to define the rules for data restrictions. MySQL provides various types of constraints as:
NOT NULL- does not allow NULL value
UNIQUE - does not allow duplicate entry in column
PRIMARY KEY - uniquely identify a rows in a table
FOREIGN KEY - Primary Key of another table is being as a reference in another table
CHECK - Check for the valid data to be saved in the database
DEFAULT - set the default value for the column, in case of no value passed to SQL statement.
We can declare MySQL CONSTRAINT at the time of table creation or we can alter table to apply CONSTRAINT.

What do you mean by index in a table?
MySQL Indexing is the indexing of data as keys to make the accessibility fast and easy. Rather than searching all over the data indexing allows to get directly to the indexed values. It Eliminates the unnecessary iteration because the indexes are stored in the form of B.Tree.

Basic MySQL Interview Questions and Answers

By Dhananjay yadav → March 19, 2018


What is MySQL?
MySQL is a Relational Database Management System marketed and distributed by Oracle as an open source software. However, enterprise edition is also available with support systems.

What is Relational Database?
Yes, we can say a database as a Relational database, because tables in the database are related to each other.

What is the use of the DISTINCT phrase in MySQL?
DISTINCT eliminates the duplicate records in the selection and return unique values. We can use it also with aggregate functions like AVG, SUM, MAX, MIN etc.

What is SELF JOIN?
Join a table to itself is called SELF JOIN. We must use an alias of the table to join itself. There is no any phrase like SELF JOIN.

What is LEFT JOIN?
LEFT JOIN gets the column of the LEFT table if the relation exists with the next table.

What is CROSS JOIN?
CROSS JOIN is a cartesian product of two tables and does not require any join condition. CROSS JOIN used to JOIN two table having no relations.If table A has 100 rows and Table B has 200 rows then we will get 100x200 = 20000 rows in CROSS JOIN.

What is INNER JOIN?
INNER JOIN gets all the records that are matched or common between the tables followed by the condition.

What is FULL JOIN?
FULL JOINS returns the records from both the tables. It is the result of LEFT JOIN and RIGHT JOIN at the same time.

What is RIGHT JOIN?
RIGHT JOIN results in the column of the RIGHT table if the relation exists with the next table.


What is OUTER JOIN?
LEFT JOIN, RIGHT JOIN and FULL JOIN are OUTER joins.

What are aggregate functions in MySQL?
The function that performs a calculation on records and returns a resulting single value is known n as an aggregate function. We have many aggregate functions in MySQL. As : AVG,SUM,MIN,MAX,COUNT.

What is the difference between DISTINCT and GROUP BY?
DISTINCT can return NULL values because it considers NULL as a value and selects one NULL from many, however, GROUP BY does not consider NULL values as a record. GROUP BY sorts the records where DISTINCT does not.

What is VIEW MySQL?
VIEW is an imaginary table holding the real records, based on query statements. It fetches data from real tables and displays always updated values. We can do all the MySQL operations on it.  It helps to achieve security and reusability while implementing database operations. We can hide sensitive data from end users while limiting the access of original tables.
For example, we can have a VIEW for all the employee who is older than 40 years.

CREATE VIEW older_than_fourty AS SELECT * FROM employee WHERE age > 40 ;




JSON Interview Questions and Answers

By Dhananjay yadav → March 15, 2018

JSON Interview Question and Answers
What is JSON?
JSON: JavaScript Object Notation is a tool to exchange data. It is defined as a javascript object. Using JSON we can store javascript Objects as text. When it will be required we can convert text into objects.

Is it possible to have an array of JSON or JSON having the array as values?
Yes, it is possible to do so. We can define a key in JSON having an array as value and we also can define an array having a JSON as value.

What is the use of JSON?
JSON is used to exchange data from the server. Since it is a text string, it is faster than any other format like XML.

What is JSON.parse() ?
JSON.parse() , parse the JSON string and return an full fetured object.

What is JSON.stringify()?
JSON.stringify(), convert the JSON Objects into string.

How can we handle the JSON in PHP?
PHP provides functions to handle the JSON. We can parse JSON using PHP and can convert it into an array. Function we use to convert a JSON to Object is json_decode(); json_decode() convert Javascript Object into PHP object. If we pass second argument in it as "true" it will return an associative array.




What is JSONP?
JSONP is called JSON with Padding. This is used to exchange data on cross sites protocols.

Basic Java Script Interview Questions and Answers

By Dhananjay yadav →

What is Javascript?
Javascript is a client-side scripting language, used to enhance webpage functionality and User Experience.

What is the importance of Javascript in Web Development and Web design?
Javascript provide additional functionality to HTML elements. It handles the DOM and content dynamically. Javascript is used by all the giant players in software industries like Microsoft, Google, Facebook, Amazon etc.

How can we define a variable in javascript?
We can define a variable in javascript using 'var' keyword. for example :

var userName = 'Vishal Agrawaal';


What are the methods to return output in javascript?
We use alert(),console.log() and document.write() to display output in javascript.

What is an alert?
Alert is a dialog box to display some warning or error.It displays a message on dialogue and a close button or OK button by default.

How to get a value by the ID of the element?
We can find the value by using Javascript function
var employee_name = documenst.getElementById('element_id').value;

What is DOM?
The HTML DOM model is a tree of Objects and Objects are created by HTML the elements when page loaded.It allow us to acces the content and allow us to manipulate the HTML elements properties and attributes dynamically using Javascript or other script.


What is event?
An event is an action that takes place followed by any DOM activity or manipulation. Javascript provides a vast range of events that helps to create interactive interfaces in HTML. For example : onchange,onclick,onblur,onfocus,onmouseover,onkeypress,onkeyup,onmouseout,onload ect.


How to create a function in Javascript?
Syantx to create a function in javascript:

function myFunction(){
//function logic goes here
}


Can JavaScript replace PHP or JSP or ASP?
Never, Not comparable. Javascript is a client-side scripting language whereas PHP and other are the server-side scripting language. So there is no any reason for replacement.

How to define an array in Javascript?
Defining an array in javascript is similar to any other language:

var students=['Ram','Vishal','Rahul','Kallu','Ballu','Lallu'];


How to handle date in javascript?
Javascript provides a constructor Date(). We can use Objects created by Date() and can Handle dates.For example:

var date = new Date();
var today = date.getDay();
var hour = date.getHours();
var minute = date.getMinutes();
var second = date.getSeconds();


How to anver an array into an string in Javascript?
We have an array :

var cars = ["BMW", "Benz", "Toyota", "Ford"];
var carString= car.toString();

and result will be :BMW,Benz,Toyota,Ford .

What is the functionality of pop() in js?
pop() is a standard method in javascript and it removes the last element of an array when we apply.
for example, we can apply it on cars :

cars.pop();

Now cars array will be : ["BMW", "Benz", "Toyota"];

What is the functionality of push() in js?
pop() is a standard method in javascript and it adds an element at the end of an array when we apply.
for example, we can apply it on cars :

cars.push("FORD");

Now cars array will be : ["BMW", "Benz", "Toyota", "Ford"];

What is the functionality of splice() in js?
splice() added element/s at the particular index of an array and can remove some elements form the index. It can be used to relace some element in the array.

var cars = ["BMW", "Benz", "Toyota", "Ford"];
fruits.splice(1, 0, "Ferari");

Resulting array : ["BMW", "Ferari","Benz", "Toyota", "Ford"];
First parameter is the index of the elemnet where the new elemnet will be added and second is the number of elements will be removed from that index.

How to apply a for loop in an array in Javascript?
Example of for loop in javascript:

var text='';
for (var i = 0; i < cars.length; i++) { 
text += cars[i] + "
";
}
alert(text);