Showing posts with label Interview Questions. Show all posts
Showing posts with label Interview Questions. Show all posts

Thursday, 16 March 2017

CakePHP Interview Questions and Answers for fresher + experienced

Here we’ll discuss about some basic and advanced cakephp interview questions and answers which are most ask-able questions during interview session, These CakePHP questions and answers will help you to crack CakePHP technical interview round.

Question: What is Cakephp?

CakePHP is a free, open-source, MVC (Model, View, Controller) rapid development framework for PHP. It’s a framework which help you to make development fast and secure. CakePHP goal is to enable developers to work in a structured and rapid manner–without loss of flexibility.


Question: What is MVC in CakePHP?

Model view controller (MVC) is an architectural pattern used in software engineering.
Model: Handle database related functionality, manipulating database related query like add, edit , delete.
View: Design parts written here (HTML+PHP)
Controller: Business Logic goes here

Question: What Is The Name Of Cakephp Database Configuration File Name And Its Location?

FileName: database.php.default
Location: /app/config/database.php.default

Question: What is First cakphpe file loaded in application?

bootstrap.php


Question: What is the folder structure of CakePHP?

cakephp/
app/
Config/
Console/
Controller/
Lib/
  Locale/
  Model/
  Plugin/
  Test/
  tmp/
  Vendor/
  View/
  webroot/
    .htaccess
  index.php

 lib/
 plugins/
 vendors/
 .htaccess/
 index.php/
 README.md/

Question:What Is The Use Of Security.Salt And Security.CipherSeed In Cakephp?

The Security.salt is used for generating hashes.
The Security.cipherseed is used for encrypt/decrypt strings.

Question: What is default function for a controller?

function index() is default function in controller.


Question:Which function is executed before every action in the controller?

function beforeFilter()

Question: What Is Scaffolding In Cakephp?

Scaffolding is a technical way that allows a developer to define and create a basic application that can create, retrieve, update and delete objects.

Question: List some of the features in CakePHP?

* MVC architecture
* In-Built validations
* Caching
* Scaffolding
* CSRF protection via Security Component.
* Access Control Lists and Authentication and creating role management system.

Question: How to add Scaffolding in your application?

By adding $scaffold variable in the controller see following example.

<?php
class PostsController extends AppController {
    var $scaffold;
}
?>

Question: How To Include Components In Controller?


echo $this->here;

Question: How To Get Controller Name In CakePHP Views?

$this->request->params['controller']


Question: How To Get Controller Action Name In CakePHP Views?

$this->request->params['action']

Question: Which Methods Are Used To bind And Destroy Model Associations?

bindModel() : used to bind Model Associations
unbindModel() : used to destroy Model Associations

Question: What Is The Default Extension Of view files In Cakephp?

.ctp

Question: What is a Helper in CakePHP?

Helpers in CakePHP are associated with Presentation layers of application.Helpers mainly contain presentational logic which is available to share between many views, elements, or layouts

Question:What is a Behavior in CakePHP?

Behaviors in CakePHP are associated with Models.Behaviors are used to change the way models behaves and enforcing model to act as something else.

Question: What is the difference between Component, Helper, Behavior?

Component is a Controller extension, Helpers are View extensions, Behavior is a Model Extension.

Question: How to set variables for views?

$this->set('name','Cake PHP');

Question: How to set layout for controller

By adding $layout variable in the controller see following example.

<?php
class PostsController extends AppController {
    public $layout = 'layoutname';
}
?>

Setting layout for particular action,

layout = ‘layoutname’;
}
}
?>

Question: How to write, read and delete the Session in cakephp?

$this->Session->write(‘User.name’, ‘Rohit Kumar’);
$black = $this->Session->read(‘User.name’);
$this->Session->delete(‘User’);

Monday, 20 February 2017

Top 85 JavaScript Interview Questions & Answers

Top 85 JavaScript Interview Questions & Answers




1. What is JavaScript?

JavaScript is a client-side as well as server side scripting language that can be inserted into HTML pages and is understood by web browsers. JavaScript is also an Object Oriented Programming language


2. Enumerate the differences between Java and JavaScript?

Java is a complete programming language. In contrast, JavaScript is a coded program that can be introduced to HTML pages. These two languages are not at all inter-dependent and are designed for the different intent.  Java is an object – oriented programming (OOPS) or structured programming language like C++ or C whereas JavaScript is a client-side scripting language and it is said to be unstructured programming.


3. What are JavaScript types?

Following are the JavaScript types:

    Number
    String
    Boolean
    Function
    Object
    Null
    Undefined


4. What is the use of isNaN function?

isNan function returns true if the argument is not a number otherwise it is false.


5. Between JavaScript and an ASP script, which is faster?

JavaScript is faster. JavaScript is a client-side language and thus it does not need the assistance of the web server to execute. On the other hand, ASP is a server-side language and hence is always slower than JavaScript.  Javascript now is also a server side language (nodejs).
javascript-code-snippet

JavaScript



6. What is negative infinity?

Negative Infinity is a number in JavaScript which can be derived by dividing negative number by zero.


7. Is it possible to break JavaScript Code into several lines?

Breaking within a string statement can be done by the use of a backslash, ‘\’, at the end of the first line

Example:
document.write("This is \a program");



And if you change to a new line when not within a string statement, then javaScript ignores break in line.

Example:


var x=1, y=2,

z=

x+y;

The above code is perfectly fine, though not advisable as it hampers debugging.


8. Which company developed JavaScript?

Netscape is the software company who developed JavaScript.


9. What are undeclared and undefined variables?

Undeclared variables are those that do not exist in a program and are not declared. If the program tries to read the value of an undeclared variable, then a runtime error is encountered.

Undefined variables are those that are declared in the program but have not been given any value. If the program tries to read the value of an undefined variable, an undefined value is returned.


10. Write the code for adding new elements dynamically?

<html> 
<head> <title>t1</title> 
<script type="text/javascript"> 
function addNode() { var newP = document.createElement("p"); 
var textNode = document.createTextNode(" This is a new text node"); 
newP.appendChild(textNode); document.getElementById("firstP").appendChild(newP); } 
</script> </head> 
<body> <p id="firstP">firstP<p> </body> 
</html>



11. What are global variables? How are these variable declared and what are the problems associated with using them?

Global variables are those that are available throughout the length of the code, that is, these have no scope. The var keyword is used to declare a local variable or object. If the var keyword is omitted, a global variable is declared.

Example:

// Declare a global globalVariable = “Test”;

The problems that are faced by using global variables are the clash of variable names of local and global scope. Also, it is difficult to debug and test the code that relies on global variables.


12. What is a prompt box?

A prompt box is a box which allows the user to enter input by providing a text box.  Label and box will be provided to enter the text or number.


13. What is ‘this’ keyword in JavaScript?

‘This’ keyword refers to the object from where it was called.


14. Explain the working of timers in JavaScript? Also elucidate the drawbacks of using the timer, if any?

Timers are used to execute a piece of code at a set time or also to repeat the code in a given interval of time. This is done by using the functions setTimeout, setInterval and clearInterval.

The setTimeout(function, delay) function is used to start a timer that calls a particular function after the mentioned delay. The setInterval(function, delay) function is used to repeatedly execute the given function in the mentioned delay and only halts when cancelled. The clearInterval(id) function instructs the timer to stop.

Timers are operated within a single thread, and thus events might queue up, waiting to be executed.


15. Which symbol is used for comments in Javascript?

// for Single line comments and

/*   Multi

Line

Comment

*/


16. What is the difference between ViewState and SessionState?

‘ViewState’ is specific to a page in a session.

‘SessionState’ is specific to user specific data that can be accessed across all pages in the web application.



17. What is === operator?

=== is called as strict equality operator which returns true when the two operands are having the same value without any type conversion.


18. Explain how can you submit a form using JavaScript?

To submit a form using JavaScript use document.form[0].submit();

document.form[0].submit();


19. Does JavaScript support automatic type conversion?

Yes JavaScript does support automatic type conversion, it is the common way of type conversion used by JavaScript developers


20. How can the style/class of an element be changed?

It can be done in the following way:

document.getElementById(“myText”).style.fontSize = “20?;

or

document.getElementById(“myText”).className = “anyclass”;


21. Explain how to read and write a file using JavaScript?

There are two ways to read and write a file using JavaScript

    Using JavaScript extensions
    Using a web page and Active X objects


22. What are all the looping structures in JavaScript?

Following are looping structures in Javascript:

    For
    While
    do-while loops


23. What is called Variable typing in Javascript?

Variable typing is used to assign a number to a variable and the same variable can be assigned to a string.

Example

i = 10;
i = "string";

This is called variable typing.


24. How can you convert the string of any base to integer in JavaScript?

The parseInt() function is used to convert numbers between different bases. parseInt() takes the string to be converted as its first parameter, and the second parameter is the base of the given string.

In order to convert 4F (of base 16) to integer, the code used will be –
parseInt ("4F", 16);



25. Explain the difference between “==” and “===”?

“==” checks only for equality in value whereas “===” is a stricter equality test and returns false if either the value or the type of the two variables are different.


26. What would be the result of 3+2+”7″?

Since 3 and 2 are integers, they will be added numerically. And since 7 is a string, its concatenation will be done. So the result would be 57.


27. Explain how to detect the operating system on the client machine?

In order to detect the operating system on the client machine, the navigator.appVersion string (property) should be used.


28. What do mean by NULL in Javascript?

The NULL value is used to represent no value or no object.  It implies no object or null string, no valid boolean value, no number and no array object.


29. What is the function of delete operator?

The functionality of delete operator is used to delete all variables and objects in a program but it cannot delete variables declared with VAR keyword.


30. What is an undefined value in JavaScript?

Undefined value means the

    Variable used in the code doesn’t exist
    Variable is not assigned to any value
    Property doesn’t exist


31. What are all the types of Pop up boxes available in JavaScript?

    Alert
    Confirm and
    Prompt


32. What is the use of Void(0)?

Void(0) is used to prevent the page from refreshing and parameter “zero” is passed while calling.

Void(0) is used to call another method without refreshing the page.


33. How can a page be forced to load another page in JavaScript?

The following code has to be inserted to achieve the desired effect:
<script language="JavaScript" type="text/javascript" >

<!-- location.href="http://newhost/newpath/newfile.html"; //--></script>


34. What is the data type of variables of in JavaScript?

All variables in the JavaScript are object data types.


35. What is the difference between an alert box and a confirmation box?

An alert box displays only one button which is the OK button.

But a Confirmation box displays two buttons namely OK and cancel.


36. What are escape characters?

Escape characters (Backslash) is used when working with special characters like single quotes, double quotes, apostrophes and ampersands. Place backslash before the characters to make it display.

Example:

document.write "I m a "good" boy"
document.write "I m a \"good\" boy"


37. What are JavaScript Cookies?

Cookies are the small test files stored in a computer and it gets created when the user visits the websites to store information that they need. Example could be User Name details and shopping cart information from the previous visits.


38. Explain what is pop()method in JavaScript?

The pop() method is similar as the shift() method but the difference is that the Shift method works at the start of the array.  Also the pop() method take the last element off of the given array and returns it. The array on which is called is then altered.
Example:

var cloths = [“Shirt”, “Pant”, “TShirt”];
cloths.pop();
//Now cloth becomes Shirt,Pant


39. Whether JavaScript has concept level scope?

No. JavaScript does not have concept level scope. The variable declared inside the function has scope inside the function.


40. Mention what is the disadvantage of using innerHTML in JavaScript?

If you use innerHTML in JavaScript the disadvantage is

    Content is replaced everywhere
    We cannot use like “appending to innerHTML”
    Even if you use +=like “innerHTML = innerHTML + ‘html’” still the old content is replaced by html
    The entire innerHTML content is re-parsed and build into elements, therefore its much slower
    The innerHTML does not provide validation and therefore we can potentially insert valid and broken HTML in the document and break it


41. What is break and continue statements?

Break statement exits from the current loop.

Continue statement continues with next statement of the loop.

42. What are the two basic groups of dataypes in JavaScript?

They are as –

    Primitive
    Reference types.

Primitive types are number and Boolean data types. Reference types are more complex types like strings and dates.

43. How generic objects can be created?

Generic objects can be created as:

var I = new object();


44. What is the use of type of operator?

‘Typeof’ is an operator which is used to return a string description of the type of a variable.


45. Which keywords are used to handle exceptions?

Try… Catch—finally is used to handle exceptions in the JavaScript
Try{

Code

}

Catch(exp){

Code to throw an exception

}

Finally{

Code runs either it finishes successfully or after catch

}


46. Which keyword is used to print the text in the screen?

document.write(“Welcome”) is used to print the text – Welcome in the screen.


47. What is the use of blur function?

Blur function is used to remove the focus from the specified object.


48. What is variable typing?

Variable typing is used to assign a number to a variable and then assign string to the same variable. Example is as follows:

i= 8;
i=”john”;


49. How to find operating system in the client machine using JavaScript?

The ‘Navigator.appversion’ is used to find the name of the operating system in the client machine.


50. What are the different types of errors in JavaScript?

There are three types of errors:

 Load time errors: Errors which come up when loading a web page like improper syntax errors are known as Load time errors and it generates the errors dynamically.
 
Run time errors: Errors that come due to misuse of the command inside the HTML language.

Logical Errors: These are the errors that occur due to the bad logic performed on a function which is having different operation.


51. What is the use of Push method in JavaScript?

The push method is used to add or append one or more elements to the end of an Array. Using this method, we can append multiple elements by passing multiple arguments


52. What is unshift method in JavaScript?

Unshift method is like push method which works at the beginning of the array.  This method is used to prepend one or more elements to the beginning of the array.


53. What is the difference between JavaScript and Jscript?

Both are almost similar. JavaScript is developed by Netscape and Jscript was developed by Microsoft .

54. How are object properties assigned?

Properties are assigned to objects in the following way –

obj["class"] = 12;

or

obj.class = 12;


55. What is the ‘Strict’ mode in JavaScript and how can it be enabled?

Strict Mode adds certain compulsions to JavaScript. Under the strict mode, JavaScript shows errors for a piece of codes, which did not show an error before, but might be problematic and potentially unsafe. Strict mode also solves some mistakes that hamper the JavaScript engines to work efficiently.

Strict mode can be enabled by adding the string literal “use strict” above the file. This can be illustrated by the given example:

function myfunction()

{

“use strict";

var v = “This is a strict mode function";

}


56. What is the way to get the status of a CheckBox?

The status can be acquired as follows –

alert(document.getElementById(‘checkbox1’).checked);

If the CheckBox will be checked, this alert will return TRUE.


57. How can the OS of the client machine be detected?

The navigator.appVersion string can be used to detect the operating system on the client machine.


58. Explain window.onload and onDocumentReady?

The onload function is not run until all the information on the page is loaded. This leads to a substantial delay before any code is executed.

onDocumentReady loads the code just after the DOM is loaded. This allows early manipulation of the code.


59. How will you explain closures in JavaScript? When are they used?

Closure is a locally declared variable related to a function which stays in memory when the function has returned.

For example:

function greet(message) {

console.log(message);

}

function greeter(name, age) {

return name + " says howdy!! He is " + age + " years old";

}

// Generate the message

var message = greeter("James", 23);

// Pass it explicitly to greet

greet(message);

This function can be better represented by using closures

function greeter(name, age) {

var message = name + " says howdy!! He is " + age + " years old";

return function greet() {

console.log(message);

};

}

// Generate the closure

var JamesGreeter = greeter("James", 23);

// Use the closure

JamesGreeter();


60. How can a value be appended to an array?

A value can be appended to an array in the given manner –

arr[arr.length] = value;


61. Explain the for-in loop?

The for-in loop is used to loop through the properties of an object.

The syntax for the for-in loop is –

for (variable name in object){

statement or block to execute

}

In each repetition, one property from the object is associated to the variable name, and the loop is continued till all the properties of the object are depleted.


62. Describe the properties of an anonymous function in JavaScript?

A function that is declared without any named identifier is known as an anonymous function. In general, an anonymous function is inaccessible after its declaration.

Anonymous function declaration –

var anon = function() {

alert('I am anonymous');

};

anon();


63. What is the difference between .call() and .apply()?

The function .call() and .apply() are very similar in their usage except a little difference. .call() is used when the number of the function’s arguments are known to the programmer, as they have to be mentioned as arguments in the call statement. On the other hand, .apply() is used when the number is not known. The function .apply() expects the argument to be an array.

The basic difference between .call() and .apply() is in the way arguments are passed to the function. Their usage can be illustrated by the given example.

var someObject = {

myProperty : 'Foo',

myMethod : function(prefix, postfix) {

alert(prefix + this.myProperty + postfix);

}

};

someObject.myMethod('<', '>'); // alerts '<Foo>'

var someOtherObject  = {

myProperty : 'Bar'

};

someObject.myMethod.call(someOtherObject, '<', '>'); // alerts '<Bar>'

someObject.myMethod.apply(someOtherObject, ['<', '>']); // alerts '<Bar>'


64. Define event bubbling?

JavaScript allows DOM elements to be nested inside each other. In such a case, if the handler of the child is clicked, the handler of parent will also work as if it were clicked too.


65. Is JavaScript case sensitive? Give an example?

Yes, JavaScript is case sensitive. For example, a function parseInt is not same as the function Parseint.


66. What boolean operators can be used in JavaScript?

The ‘And’ Operator (&&), ‘Or’  Operator (||) and the ‘Not’ Operator (!) can be used in JavaScript.

*Operators are without the parenthesis.


67. How can a particular frame be targeted, from a hyperlink, in JavaScript?

This can be done by including the name of the required frame in the hyperlink using the ‘target’ attribute.

<a href=”newpage.htm” target=”newframe”>>New Page</a>


68. What is the role of break and continue statements?

Break statement is used to come out of the current loop while the continue statement continues the current loop with a new recurrence.


69. Write the point of difference between web-garden and a web-farm?

Both web-garden and web-farm are web hosting systems. The only difference is that web-garden is a setup that includes many processors in a single server while web-farm is a larger setup that uses more than one server.


70. How are object properties assigned?

Assigning properties to objects is done in the same way as a value is assigned to a variable. For example, a form object’s action value is assigned as ‘submit’ in the following manner –

Document.form.action=”submit”


71. What is the method for reading and writing a file in JavaScript?

This can be done by Using JavaScript extensions (runs from JavaScript Editor), example for opening of a file –

fh = fopen(getScriptPath(), 0);


72. How are DOM utilized in JavaScript?

DOM stands for Document Object Model and is responsible for how various objects in a document interact with each other. DOM is required for developing web pages, which includes objects like paragraph, links, etc. These objects can be operated to include actions like add or delete. DOM is also required to add extra capabilities to a web page. On top of that, the use of API gives an advantage over other existing models.


73. How are event handlers utilized in JavaScript?

Events are the actions that result from activities, such as clicking a link or filling a form, by the user. An event handler is required to manage proper execution of all these events. Event handlers are an extra attribute of the object. This attribute includes event’s name and the action taken if the event takes place.


74. Explain the role of deferred scripts in JavaScript?

By default, the parsing of the HTML code, during page loading, is paused until the script has not stopped executing. It means, if the server is slow or the script is particularly heavy, then the webpage is displayed with a delay. While using Deferred, scripts delays execution of the script till the time HTML parser is running. This reduces the loading time of web pages and they get displayed faster.


75. What are the various functional components in JavaScript?

The different functional components in JavaScript are-

First-class functions: Functions in JavaScript are utilized as first class objects. This usually means that these functions can be passed as arguments to other functions, returned as values from other functions, assigned to variables or can also be stored in data structures.

Nested functions: The functions, which are defined inside other functions, are called Nested functions. They are called ‘everytime’ the main function is invoked.


76. Write about the errors shown in JavaScript?

JavaScript gives a message if it encounters an error. The recognized errors are –

Load-time errors: The errors shown at the time of the page loading are counted under Load-time errors. These errors are encountered by the use of improper syntax, and thus are detected while the page is getting loaded.
   
Run-time errors: This is the error that comes up while the program is running. It is caused by illegal operations, for example, division of a number by zero, or trying to access a non-existent area of the memory.
   
Logic errors: It is caused by the use of syntactically correct code, which does not fulfill the required task. For example, an infinite loop.


77. What are Screen objects?

Screen objects are used to read the information from the client’s screen. The properties of screen objects are –

    AvailHeight: Gives the height of client’s screen
    AvailWidth: Gives the width of client’s screen.
    ColorDepth: Gives the bit depth of images on the client’s screen
    Height: Gives the total height of the client’s screen, including the taskbar
    Width: Gives the total width of the client’s screen, including the taskbar


78. Explain the unshift() method ?

This method is functional at the starting of the array, unlike the push(). It adds the desired number of elements to the top of an array. For example –

var name = [ "john" ];

name.unshift( "charlie" );

name.unshift( "joseph", "Jane" );

console.log(name);

The output is shown below:

[" joseph "," Jane ", " charlie ", " john "]


79. Define unescape() and escape() functions?

The escape () function is responsible for coding a string so as to make the transfer of the information from one computer to the other, across a network.

For Example:

<script>

document.write(escape(“Hello? How are you!”));

</script>


Output: Hello%3F%20How%20are%20you%21

The unescape() function is very important as it decodes the coded string.

It works in the following way. For example:

<script>

document.write(unescape(“Hello%3F%20How%20are%20you%21”));

</script>


Output: Hello? How are you!


80. What are the decodeURI() and encodeURI()?

EncodeURl() is used to convert URL into their hex coding. And DecodeURI() is used to convert the encoded URL back to normal.

<script>

var uri="my test.asp?name=ståle&car=saab";

document.write(encodeURI(uri)+ "<br>");

document.write(decodeURI(uri));

</script>


Output –

my%20test.asp?name=st%C3%A5le&car=saab

my test.asp?name=ståle&car=saab


81. Why it is not advised to use innerHTML in JavaScript?

innerHTML content is refreshed every time and thus is slower. There is no scope for validation in innerHTML and, therefore, it is easier to insert rouge code in the document and, thus, make the web page unstable.


82. What does the following statement declares?

var myArray = [[[]]];


It declares a three dimensional array.


83. How are JavaScript and ECMA Script related?

ECMA Script are like rules and guideline while Javascript is a scripting language used for web development.


84. What is namespacing in JavaScript and how is it used?

Namespacing is used for grouping the desired functions, variables etc. under a unique name. It is a name that has been attached to the desired functions, objects and properties. This improves modularity in the coding and enables code reuse.


85. How can JavaScript codes be hidden from old browsers that don’t support JavaScript?

For hiding JavaScript codes from old browsers:

Add “<!–” without the quotes in the code just after the <script> tag.

Add “//–>” without the quotes in the code just before the <script> tag.

Old browsers will now treat this JavaScript code as a long HTML comment. While, a browser that supports JavaScript, will take the “<!–” and “//–>” as one-line comments.

Sunday, 19 February 2017

Top 25 Node.js Interview Questions & Answers

Top 25 Node.js Interview Questions & Answers



1)      What is node.js?

Node.js is a Server side scripting which is used to build scalable programs. Its multiple advantages over other server side languages, the prominent being non-blocking I/O.


2)      How node.js works?

Node.js works on a v8 environment, it is a virtual machine that utilizes JavaScript as its scripting language and achieves high output via non-blocking I/O and single threaded event loop.


3)      What do you mean by the term I/O ?

I/O is the shorthand for input and output, and it will access anything outside of your application. It will be loaded into the machine memory to run the program, once the application is started.

NodeJS


4)      What does event-driven programming mean?

In computer programming, event driven programming is a programming paradigm in which the flow of the program is determined by events like messages from other programs or threads. It is an application architecture technique divided into two sections 1) Event Selection 2) Event Handling


5)      Where can we use node.js?

Node.js can be used for the following purposes

  a)      Web applications ( especially real-time web apps )
  b)      Network applications
  c)       Distributed systems
  d)      General purpose applications


6)      What is the advantage of using node.js?

  a)      It provides an easy way to build scalable network programs
  b)      Generally fast
  c)       Great concurrency
  d)      Asynchronous everything
  e)      Almost never blocks


7)      What are the two types of API functions in Node.js ?

The two types of API functions in Node.js are

a)      Asynchronous, non-blocking functions
b)      Synchronous, blocking functions


8)      What is control flow function?

A generic piece of code which runs in between several asynchronous function calls is known as control flow function.


9)      Explain the steps how “Control Flow” controls the functions calls?

a)      Control the order of execution
b)      Collect data
c)       Limit concurrency
d)      Call the next step in program


10)   Why Node.js is single threaded?

For async processing, Node.js was created explicitly as an experiment. It is believed that more performance and scalability can be achieved by doing async processing on a single thread under typical web loads than the typical thread based implementation.


11)   Does node run on windows?

Yes – it does. Download the MSI installer from http://nodejs.org/download/


12)   Can you access DOM in node?

No, you cannot access DOM in node.


13)   Using the event loop what are the tasks that should be done asynchronously?

a)      I/O operations
b)      Heavy computation
c)       Anything requiring blocking


14)   Why node.js is quickly gaining attention from JAVA programmers?

Node.js is quickly gaining attention as it is a loop based server for JavaScript. Node.js gives user the ability to write the JavaScript on the server, which has access to things like HTTP stack, file I/O, TCP and databases.


15)   What are the two arguments that async.queue takes?

The two arguments that async.queue takes

a)      Task function
b)      Concurrency value


16)   What is an event loop in Node.js ?

To process and handle external events and to convert them into callback invocations an event loop is used. So, at I/O calls, node.js can switch from one request to another .


17)   Mention the steps by which you can async in Node.js?

By following steps you can async Node.js

a)      First class functions
b)      Function composition
c)       Callback Counters
d)      Event loops


18)    What are the pros and cons of Node.js?

Pros:

a)      If your application does not have any CPU intensive computation, you can build it in Javascript top to bottom, even down to the database level if you use JSON storage object DB like MongoDB.

b)      Crawlers receive a full-rendered HTML response, which is far more SEO friendly rather than a single page application or a websockets app run on top of Node.js.

Cons:

a)       Any intensive CPU computation will block node.js responsiveness, so a threaded platform is a better approach.
b)      Using relational database with Node.js is considered less favourable


19)   How Node.js overcomes the problem of blocking of I/O operations?

Node.js solves this problem by putting the event based model at its core, using an event loop instead of threads.


20)   What is the difference between Node.js vs Ajax?

The difference between Node.js and Ajax is that, Ajax (short for Asynchronous Javascript and XML) is a client side technology, often used for updating the contents of the page without refreshing it. While,Node.js is Server Side Javascript, used for developing server software. Node.js does not execute in the browser but by the server.


21)   What are the Challenges with Node.js ?

Emphasizing on the technical side, it’s a bit of challenge in Node.js to have one process with one thread to scale up on multi core server.


22)    What does it mean “non-blocking” in node.js?

In node.js “non-blocking” means that its IO is non-blocking.  Node uses “libuv” to handle its IO in a platform-agnostic way. On windows, it uses completion ports for unix it uses epoll or kqueue etc. So, it makes a non-blocking request and upon a request, it queues it within the event loop which call the JavaScript ‘callback’ on the main JavaScript thread.


23)   What is the command that is used in node.js to import external libraries?

Command “require” is used for importing external libraries, for example, “var http=require (“http”)”.  This will load the http library and the single exported object through the http variable.


24)   Mention the framework most commonly used in node.js?

“Express” is the most common framework used in node.js


25)   What is ‘Callback’ in node.js?

Callback function is used in node.js to deal with multiple requests made to the server. Like if you have a large file which is going to take a long time for a server to read and if you don’t want a server to get engage in reading that large file while dealing with other requests, call back function is used. Call back function allows the server to deal with pending request first and call a function when it is finished.

Saturday, 18 February 2017

Top 40 WordPress Interview Questions & Answers

Top 40 WordPress Interview Questions & Answers


1) What is WordPress?

Word press is a best Open Source CMS which allows it to be used free of cost.  You can use it on any kind of personal or commercial website without have to pay a single penny for it. It is built on PHP/MySQL (which is again Open Source) and licensed under GPL.


2) How safe is website on WordPress?

 The word press is safe to operate but still it is suggested to keep updating with the latest version of WordPress to avoid hacking.


3) Are there any limitations to a WordPress web site?

You can use WordPress for e-commerce sites, membership sites, photo galleries and any other type of site you can think of. The web site is created using the same html code as any other site so there are no limitations there either.


4) Do you need to have a blog in order to use WordPress for site?

WordPress was originally used as blogging software though it has since become popular for website also.  It is not necessary to have a blog to use wordpress.  Still having blog is commendable as it will help in search engine optimization.


5) From SEO point of view is wordpress helpful? Will it show the website on Google?

 It is one of the benefit of using wordpress, it has inbuilt SEO search engine. Also, you can have an additional plug-in in wordpress to help with SEO and rank on a popular search engine like Google.


6) What is the current version of wordpress?

You need to quote the current version of WordPress available in market along with the release date.


7) What are the types of hooks in WordPress and mention their functions?

There are two types of hooks 1) Action hooks 2) Filter hooks

Hooks allow user to create WordPress theme or plugin with shortcode without changing the original files. Action hooks allow you to insert an additional code from an outside resource, whereas, Filter hooks will only allow you to add a content or text at the end of the post.


8) What do you mean by custom field in wordpress?

Custom field is a meta-data that allows you to store arbitrary information to the wordpress post. Through custom field extra information can be added to the post.


9) What are the positive aspects of wordpress?

Few positive aspects of wordpress are

  • Easy installation and upgrade
  • In-built SEO engine
  • Easy theme system
  • Flexibility
  • Multilingual- available in more than 70 languages
  • Own data- no unwanted advert on your website
  • Flexibility and Easy publishing option


10) What are the rules that you have to follow for wordpress plugin development?

  • Create a unique name
  • Create the plugin’s folder
  • Create a sub-folder for PHP files,  translations and assets
  • Create the main plug-in file and fill in header information
  • Create activation and de-activation functions
  • Create an uninstall script
  • Create a readme.txt file
  • To detect paths to plugin file use proper constants and functions


11) What is the prefix of wordpress tables by default?

By default, wp_ is the prefix for wordpress.


12) Why does WordPress use MySQL?

MySQL is widely available database server and is extremely fast.  It is an open source and it is available at no cost also it is supported by many low-cost Linux hosts so its easy for anyone to host their website.


13) Is it possible to rename the WordPress folder?

Yes, it is possible to rename the WordPress folder.  If WordPress is already installed you have to login to the weblog as the administrator and then change the settings

WordPress address (URI)  :

Blog address( URI) :

After making the changes, you can rename the folder or directory with the WordPress file in it.


14) How many tables are there in WordPress by default?

There are about 11 tables in WordPress by default. Note: With succeeding releases of WordPress this number will change. You need to check phpMyAdmin to determine the number of tables in a vanilla version of latest WordPress installation.


15) What is WordPress loop?

To display post WordPress use PHP code, this code is known as loop.


16) How you can disable the WordPress comment?

If you go on dashboard under options-discussion there is a comment “ Allow people to post comment” try unchecking the comment.


17) What are the steps you can take if your WordPress file is hacked?

  • Install security plug-ins like WP security
  • Re-install the latest version of WordPress
  • Change password and user-ids for all your users
  • Check your themes and plug-ins are up to date


18) What are the template tags in WordPress?

In WordPress template tags is a code that instructs WordPress to “do” or “get” something.


19) Does WordPress have cookies?

Yes, WordPress have cookies and WordPress uses cookies for verification of users while logged in.


20) In what case you don’t see plugin menu?

You can’t see your plugin menu when the blog is hosted on free wordpress.com as you cannot add plugin there.  Also, if you do not have an account of an administrator level on your WordPress is not possible to see plugin.


21)  At what instance you get locked out of your WordPress admin and see your website as a blank screen?

This would likely happen when you have pasted a code from a website with wrong formats, also when you have pasted a code in a wrong location. It may also happen when your IP is banned


22) Why you use a static front page in wordpress?

Some WordPress users wants their WordPress installation to be more than a blog site. To give their page a look more like a real website page some users use static front page.


23) What are the plugins you can use to create contact form in WordPress?

To create a contact form in WordPress you can use plugin like Gravity forms or also you can use a free plugin contact form 7.


24) Why widget does not show up in the sidebar?

While using widget you have to ensure whether your theme supports the widget and if it does then it must show the sidebar.  If in any case if it happens that you don’t see the sidebar then it might be missing the “function.php” file or file similar to that.  This can also happen if you have forgot to save the changes in the widget or refreshing the older display of the page.


25) Is there any limitation for using WordPress?

No, there is no limitation for using WordPress.  WordPress can be used for innumerable purpose membership site, e-commerce site, photo-gallery and many more.


26) How is creating a site on wordpress.org different from wordpress.com?

Most of the things are similar in both except the choices of themes and the usage of plugins.


27) Why wordpress.com is considered more secure than wordpress.org?

WordPress.com is considered more secure than wordpress.org because they limit the themes and also does not allow installing plugin’s.  However the security is more dependable on how the hosting company is hosting your website(wordpress.org) & also what are the steps they are taking to prevent the security problems.


28) Does de-activated plugins slow down a WordPress site?

No, de-activated plugins cannot slow down the WordPress site.  Wordpress only loads the active plugins and ignores everything else.


29) In what case we cannot recommend WordPress to our client?

We cannot recommend WordPress on following situation:


  • If client is working on non-CMS base project
  • If site wants complex or innovative e-commerce
  • In case of enterprise intranet solution
  • Sites requiring custom scripting solutions.



30) What are the essential features you look for a theme?

Theme selection differs according to the requirement, but an ideal theme would be something that would not restrict to use the number of pages, plugins or static homepage.


31) How Custom theme is different than Normal theme?

Custom theme allows for SEO search, but with a SEO plugin available it would not make much difference to normal theme. One benefit using the Custom theme is that it allows to make the changes without going much into the coding part.


32) How you can create a static page with WordPress?

To create a static page in wordpress, in the page section  you have to upload a php files to the server in the theme folder, and then select that as your template.  This allows you to add any page and look that you wanted for your blog and it will remain static.


33) Is there any other CMS better WordPress?

WordPress is no doubt a good CMS, but Drupal and Joomla are among the best CMS you can work with.


34) Which is the best multi-lingual plugin for wordpress?

Keeping all the limitations in mind, WPML would be the best multi-lingual plugin for wordpress .


35) Can you update your own content on the site?

It depends on the type of the site or project, but yes one can update their own content on the site.


36) What are meta-tags?

Meta-tags are keywords and description used to display website or page information.


37) What should one use for plugin development — custom post types or custom database tables?

There is no specific preference for plugin development; it depends on what type of plugin’s one has to develop. Though few recommend custom post type, as it has few benefits comparison to custom database table.


38) Can you host WordPress using  Amazon web services such as EC2, RDS, EBS etc?

Yes, you can host using Amazon web services.


39) Is there any way to write series in WordPress?

You can use organize series plugin to write series in wordpress.


40) What are the reasons why one should not hack WordPress core file?

The best reason not to hack the core files is that whatever you might be doing has to be reworked as a patch.

Friday, 17 February 2017

WordPress - Interview Questions

WordPress - Interview Questions


WordPress Interview Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject of WordPress. As per my experience good interviewers hardly plan to ask any particular question during your interview, normally questions start with some basic concept of the subject and later they continue based on further discussion and what you answer −

Question :- What is WordPress?

WordPress is an open source Content Management System (CMS), which allows the users to build dynamic websites and blog.

Question :- List some features of WordPress?

The features of WordPress are −

  • User Management
  • Media Management
  • Theme System
  • Extend with Plugins
  • Search Engine Optimized
  • Multilingual
  • Importers


Question :- What are disadvantages of WordPress?

The disadvantages of WordPress are −

  • Using several plugins can make website heavy to load and run.
  • PHP knowledge is required to do modification or changes in the WordPress website.


Sometimes software needs to be updated to keep the WordPress up to date with the current browsers and mobile devices. Updating of WordPress version leads to loss of data so it requires the backup copy of website.

Modifying and formatting the graphic images and tables is difficult.


Question :- What are the different types of gadgets present in the WordPress Dashboard?

The different types of gadgets present in the WordPress Dashboard are −

  • Dashboard Menu
  • Screen Options
  • Welcome
  • Quick Draft
  • WordPress News
  • Activity
  • At a Glance


Question :- What is the use of Quick Draft section in WordPress Dashboard?

The Quick Draft is a mini post editor allows writing, saving and publishing post from admin dashboard. It includes the title for the draft, some notes about your draft and save it as a Draft.


Question :- What is the use of WordPress News in WordPress Dashboard?

The WordPress News widget displays the latest news such as latest software version, updates, alerts, news regarding the software etc from the official WordPress blog.


Question :- What is At a glance in WordPress Dashboard?

This section gives overview of your blog's posts, number of published posts and pages, number of comments. When you click on these links, you will be taken to the respective screen. It displays the current version of running WordPress along with currently running theme on the site.


Question :- What is the use of Media setting?

It is used to set the height and widths for the images which you're going to use into your website.


Question :- What is Activity Widget in WordPress Dashboard?

The Activity widget includes latest comments on your blog, recent posts and recently published posts. It allows you to unapprove or approve the comment, reply to the comment, editing the comment or you can delete the comment or move it to spam.


Question :- What is the use of WordPress General Setting?

WordPress general setting is used to set the basic configuration settings for your site.


Question :- What is WordPress Discussion setting?

WordPress discussion setting can be defined as the interaction between the blogger and your visitors. These settings are done by the admin to have a control over the posts/pages that come in through users.


Question :- What is WordPress Writing Setting?

The writing settings controls WordPress writing experience and provides options for customizing WordPress site. These settings control WordPress's features in the adding and editing posts, Pages, and Post Types, as well as the optional functions like Remote Publishing, Post via e-mail, and Update Services.


Question :- What is wordPress Category?

Category is used to indicate sections of your site and group related posts. It sorts the group content into different sections. It is a very convenient way to organize the posts.


Question :- What is wordPress Post?

Posts are also known as articles and sometimes referred as blogs or blog posts. These are used to popularize your blogs.


Question :- What is the use of Post via e-mail option in WordPress Writing Setting?

This option uses email address to create post for you and publishes posts on your blog by email. To use this, you'll need to set up a secret e-mail account with a POP3 access, and any mail received at this address will be posted.


Question :- What is Plugin setting?

Plugin allows easily modifying, customizing or enhancing wordPress blog or post. The wordPress Plugin is software that can be uploaded to expand the functionality of the site. They add services or features to wordPress blog.


Question :- What is WordPress Reading Setting?

Reading Setting is used to set the content related to the front page. Here you can set the number of post to be displayed on the main page.


Question :- What is Preview Post in wordPress?

Preview Post is to view the post before it is published to the user. It's safer to preview your post and verify how your post looks on website.


Question :-  What is Publish Post in wordPress?

Publish is used to make the post available to all the users wherein every user can view that particular post.


Question :- What is Media Library?

Media Library consists of the images, audios, videos and files that you can upload and add to the content when writing a Post or Page.


Question :- What is Grid View in Media Library?

It displays all images in the grid format.


Question :- How media files can be inserted into the Wordpress site?

Media files can be inserted to your Pages or Posts from libraries, from local storage or from URLs.


Question :- What are pages in wordPress?

Pages are static content and often do not change its displayed information.


Question :- What is Tag in wordPress?

Tag is small information attached to main content or post for the purpose of identification. It tells the visitors what actually the post is about. If the tag is mentioned properly then it helps to find the content very easily.


Question :- What is the use of Slug field in tags?

It is used to specify the tags URL.


Question :- What are link in WordPress?

Link is a connection from one resource to another. Adding links to your pages or blog posts helps you to connect to other pages.


Question :- What is a Moderate comment?

Comment moderation is a process where, when visitors comment on posts, the comment is not published directly until and unless it is approved by the admin to be posted. It manages your comments so that there is no comment spamming.


Question :- What is the use of adding comments?

Adding comments allows your visitors to have a discussion with you. Comments are approved by the admin and then posted to be discussed further.


Question :- What is the role of Contributor in WordPress?

Contributor can only write and edit their posts until published. They can create their own posts and pages but cannot publish them. They cannot upload images or files but can see your site's status. When they want to publish any post, it must be first notified personally to the administrator by the contributor to review. When the post is approved the contributor cannot make any changes once publishe


Question :- What is Theme Management in WordPress?

Themes make your websites display with modification. It includes image files, templates, css stylesheets etc that can help you to make your website look great.


Question :- What is Customize theme?

Customizing themes helps you to give a new look to your website. Here you can change background images/colors, add titles, and do much more.


Question :- What is Widget Management?

Widgets are small blocks that perform specific functions. These give design and structure control to the WordPress theme.


  • They help you add content and features.
  • They can be easily dragged and dropped in widget area.
  • Widgets vary theme to theme. They are not same for every theme.

Question :- Mention the steps to optimize your WordPress?

The steps to optimize the WordPress are −

  • High quality and meaningful content.
  • Have right names for images.
  • Use short permalinks that include keywords.
  • Optimized themes.
  • Sitemap in XML format.
  • Connect posts to social networks.
  • Beware of black hat techniques.
  • Delete your trash box.
  • Keep Checking Your Site Statistics
  • Keep checking your plugins.
  • Using CSS and JavaScript effectively.


Question :- What is the role of Editor in WordPress?

The Editor has access to all the posts, pages, comments, categories, tags, and links. They can create, publish, edit or delete any posts or pages.


Question :- What is the role of Follower in WordPress?

Follower can only read and comment on the posts. Followers are the ones who have signed in to your account to receive updates.


Question :- What is the role of Viewer in WordPress?

Viewers can only view your posts; they cannot edit but can only comment on the posts.


Question :- What is Media Management?

It is the tool for managing the media files and folder, in which you can easily upload, organize and manage your media files on your website.


Question :- What is Multilingual?

It allows translating all the content into the user choice languages.


Question :- What is User Management?

It allows managing the user information such as changing the role of the users to (subscriber, contributor, author, editor or administrator), create or delete the user, change the password and user information. The main part of the user manager is Authentication.


Question :- Which is the PHP compatibility used for WordPress?

PHP 5.2+


Question :- What is Wordpress Dashboard?

The WordPress Dashboard is a first screen which will be seen when you log into the administration area of your blog which will display overview of the website. It is a collection of gadgets that provide information and give a glance overview of what's happening with your blog. You can customize your needs by using some quick links such as writing quick draft, replying to latest comment etc.


Question :- What is Page attribute module?

Page attributes module allows you to select parents for your particular page. You can also set order of the pages.


Question :- What is the use of WordPress Address field in General setting?

It is the URL of WordPress directory where your all core application files are present.


Question :- What is the use of Mail Server in WordPress Writing setting?

It allows reading the emails that you send to WordPress and stores them for retrieval. For this you need to have POP3 compatible mail server and it will have URI address such as mail.example.com, which you should enter here.


Question :- What are Importers?

It allows importing data in the form of posts. It imports custom files, comments, post pages and tags.


Question :- What is the use of Avatar field in Wordpress Discussion Setting?

Avatar is a small image that displays at the top-right-hand corner of the dashboard screen beside your name. It is like your profile picture.


Question :- What is WYSIWYG Editor?

WYSIWYG Editor is similar to a word processor interface where we can edit the contents of the article.


Question :- What is Permalink setting?

Permalink is a permanent link to a particular blog post or category. It allows setting the default permalink structure. These settings are used to add permalinks to your posts in Wordpress.


Question :- What is the use of Syndication feeds show the most recent field in WordPress Reading Settings?

The user can view the number of posts when they download one of the site feeds. By default, it is set as 10.


Question :- What is the use of Search Engine Visibility field in WordPress Reading settings?

It Discourage search engines from indexing this site, your site will be ignored by the search engine.

Thursday, 16 February 2017

Bootstrap Interview Questions and Answers for Fresher

Bootstrap Interview Questions and Answers for Fresher

Bootstrap is CSS+Javascript based framework to design rich application interface with minimal effort and create native design to work well on all devices like desktop tablet and mobiles. Mostly UI developer currently using bootstrap to design their website and apps So in this post I have complied some important Bootstrap Interview Questions and Answers for Fresher which help you during interview.


Question: In Which language Bootstrap is written?

HTML, CSS, LESS, Sass and JavaScript
Question: Why should use Bootstrap?

* It is helpful to create native design because of their rich device responsive libraries.
* It is supported by all popular browsers.
* Easy to get started
* It’s totally free and open sourced
* It’s totally free and open sourced
* Provides a clean and uniform solution for building an interface for developers.

Question: Who developed the Bootstrap?

Mark Otto and Jacob Thornton developed bootstrap at Twitter lab.


Question: From where we can download the Bootstrap?

Website: http://getbootstrap.com/


Question: What are the key components of Bootstrap?

CSS, Scaffolding, Layout Components, JavaScript Plugins, Customize code as per your need.


Question: What are class loaders in Bootstrap?

Class loader is a part of JRE (Java Runtime Environment) which loads Java classes into Java virtual environment. Class loaders also does the process of converting a named class into its equivalent binary form.


Question: What is Bootstrap Grid System?

Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts.


Question: What are the common bootstrap class to apply background colors.

.active, .success, .warning, .danger, .info
Question: What are different types of layout available in Bootstrap?

* Fluid Layout
* Fixed Layout


Question: What is responsive layout?

Responsive layout which is able to adapt itself to different sizes as well, but when resizing, the number of columns changes according to the available space.
Question: What are Offset columns?

Offsets are a useful feature for more specialized layouts. They can be used to push columns over for more spacing, for example. The .col-xs = * classes don’t support offsets, but they are easily replicated by using an empty cell.
Question: What function you can use to wrap a page content?

To wrap a page content you can use .container and using that you can also center the content.


Question: How you can add badge to list group in Bootstrap?

Using .badge class.


Question: What is Bootstrap well?

Bootstrap well is a container
that makes the content to appear sunken or an inset effect on the page. In order to create a well, wrap the content that you would like to appear in the well with a
containing the class of .well.


Question: What is Fluid Layout in Bootstrap?

Fluid layout adapts itself to different browser. Means design automatic adjust according to browser size.


Question: What is Fixed Layout in Bootstrap?

Fixed layout doesn’t adapts itself to different browser but it can be responsive.
Question: What are Bootstrap media queries?

Media Queries in Bootstrap allow you to move, show and hide content based on viewport size.


Question: What is Modal plugin used for in Bootstrap?

Modal Plugin is a child window that is layered over its parent window like popup


Question: What is Jumbotron?

Jumbotron is used for content that you want to highlight like some slogan OR marketing headline.
Question: How to display code in bootstrap?

By .

<code></code>


Question: What is Bootstrap collapsing elements?

Bootstrap collapsing elements enables you to collapse any element without using external JavaScript.
Question: How do you make images responsive?

Bootstrap 3 allows to make the images responsive by adding a class .img-responsive to the tag. This class applies max-width: 100%; and height: auto; to the image so that it scales nicely to the parent element.


Question: What is Bootstrap Container in Bootstrap?

Bootstrap container is a class which is useful and creating a centred area in the page for display.


Question: What is button group?

Button groups allow multiple buttons to be stacked together on a single line. This is useful when you want to place items like alignment buttons together.

HTML APIs: What They Are And How To Design A Good One

As JavaScript developers, we regularly forget that not everybody has a similar data as USA. It’s referred to as the curse of knowledge:...