Quick Contact

    Interview questions

    1. Define the term JavaScript.

      It is an object-oriented, portable integrated platform which provides web interaction to other simple Static websites. The programming language broad sense base has indeed been integrated into Navigator, Google Chrome, as well as other web services.

    2. Differentiate between Java and JavaScript.

      The difference between Java and JavaScript are as follows:

      Java JavaScript
      It is an OOP programming language. It is an OOP scripting language.
      It allows applications to run in a virtual machine or browsers. It allows applications to run only on a browser.
      The codegets compiled during the run time. The code is all in the form of text.
    3. Discuss some of the features of JavaScript?

      Some of the features of JavaScript are as follows:

      • It is an interpretation, compact software application.
      • It is a scripting language for building networked applications.
      • It is an add-on to Java that works in tandem with it.
      • HTML and JavaScript are compatible and intertwined.
      • It is a free and inter scripting language.
    4. Name the different types of data that are supported by JavaScript?

      The different types ofdata are supported by JavaScript are as follows:

      • Undefined
      • Null
      • Boolean
      • String
      • Symbol
      • Number
      • Object
    5. Describe how to create an object in JavaScript?

      To create an object in JavaScript using the object codeare as follows:

      var emp = {

      name: “Anna”,

      age: 22


    6. Discuss different types of functions.

      The different types of functions are as follows:

      • Named:

        At the period of implementation; components have a name. For example:

        function display()


        document.writeln(“Named Function”);



      • Anonymous:

        There is no name for this type of function. They are randomly generated at execution.

        var display=function()


        document.writeln(“Anonymous Function”);



    7. Among which is faster between JavaScript and an ASP script?

      JavaScriptis more efficient because it is a client-side based technology. However, it’s doesn’t require the help of the website to run. On the other side, ASP is a client language and whichis always be slower than JavaScript because JavaScript is now a server-side programming as well nodejs.

    8. Write a code to create an array in JavaScript?

      To define arrays using the array literal are as follows:

      var x = [];

      var y = [1, 2, 3, 4, 5];

    9. Explain the difference between undeclared and undefined variables?

      The difference between undeclared and undefined variables are as follows

      • Variables which do not reside in a programmed and are not defined are known as undeclared variables. A runtime error can occur if the programmed wants to read the contents of an undeclared variable.
      • Undefined variables are variables which have been established in the programmed but have yet to be assigned a value. When a programmed need to read the values of an unknown variables, it returns an undefined value.
    10. Explain the scopes of a variable in JavaScript?

      A scope variable’s is the area of your programmed where it has been specified. It consists of two scopes are as follows:

      • Global variables:

        It have a global scope that means are accessible throughout JavaScript code.

      • Local variables:

        It is only accessible within the scope of the procedure in which it is created. The parameters of a method have always been unique to the that method.

    11. What is a name function?

      A name functiondeclares a name once it is defined. It can also be defined by using function keyword are as follows:

      function named(){

      // write code here


    12. 12. What is the difference between “==” and “===” ?

      The difference between “==” and “===” are as follows:

      ” ==” only compares values “===” compare values and type both.

    13. What are argument objects and how to pass the types of arguments to a function?

      The arguments provided to a function which are represented by parameter arguments. The type of arguments provided to a function can be determined using the type of operator.


      console.log(typeof x, arguments.length);


      func(); //==> “undefined”, 0

      func(7); //==> “number”, 1

      func(“1”, “2”, “3”); //==> “string”, 3

    14. Define prototypal Inheritance.

      Every object has a model parameter to which can add procedures.When it is tried to build additional item from the newly established entity will acquire the properties of its predecessor.

    15. Name some of the built-in methods and the values returned.

      Some of the built-in methods and the values returned are as follows:

      Built-in Method Values
      CharAt() The character also at provided position is returned.
      Concat() It connects two maybe more lines together.
      forEach() For every array element, it performs a task.
      indexOf() It determines the order of first appearance of the provided value inside the caller String object.
      length() It gives the string’s width.
      pop() It provides the final component of an arrays after removing them.
      push() It extends an array by one or even more entries and provides the element’s model introduced.
      reverse() It restores the ordering of the an object’s items.
    16. Explainthe difference between Local storage & Session storage?

      The difference between Local storage & Session storage are as follows:

      • Local Storage:

        For each HTTP request the information is not included message to the browser, decreasing the amount of bandwidth between the sender and receiver. This will remain until removed explicitly via preferences or an application.

      • Session Storage:

        It is identical to storage device, with the exception that data kept in process memory expires when the webpage process has completed, whereas information stored in storage devices does not. When the website is finished, session data is removed.

    17. Describe the event bubbling.

      If an event happens in a component inside such an element and then both components has recorded a handler for the that activity, it is referred to as event bubbling in the HTML DOM Protocol.The action is initially collected and processed by the deepest component via bubble, and then transmitted to the outermost components. The implementation of that occurrence begins with that entity’s connected component. The operation then moves on to its connected component, and so on until it reaches the main component.

    18. What will be the output of the following code?
      var Output = (function(x)
      Delete X;
      return X;

      The result would be zero. An entity’s features can be deleted using the delete function. x is a local variable rather than an entity in this case. Local variables are unaffected by delete operations.

    19. Define the escape character.

      It allows to write special characters in a program with damaging it. While, interacting with special characters such as quote marks, double citations, asterisks, and curly braces, backslashis used to get the characters that appear, add a backslash over them.

      For example: document.write” Hello “JavaScript”

    20. Write a code how to use external JavaScript file?

      A code for external JavaScript file

      < script type="text/javascript" src="message.js">< /script>

    21. What is negative infinity?

      It is a value that may be computed by multiplying a negative value by zero. For example:

      var num=-5;

      function display()





    22. Write a code for submitting a form using JavaScript by clicking a link?

      A code for submitting a form using JavaScript by clicking a link are as follows:

      < form name="myform" action="index.php">

      Search: < input type='text' name='query' />

      < a href="javascript: submitform()">Search< /a>

      < /form>

      < script type="text/javascript">





      < /script>

    23. Write a code to validate a form in JavaScript?

      < script>


      var name=document.myform.name.value;

      var password=document.myform.password.value;

      if (name==null || name==””){

      alert(“Name can’t be blank”);

      return false;

      }else if(password.length<6){

      alert(“Password must be at least 6 characters long.”);

      return false;



      < /script>

      < body>

      < form name="myform" method="post" action="abc.jsp" onsubmit="return validateform()" >

      Name: < input type="text" name="name">< br/>

      Password: < input type="password" name="password">< br/>

      < input type="submit" value="register">

      < /form>

      Test it Now:

      JavaScript form validation.

      < script>



      var x=document.myform.email.value;



      if (atposition<1 || dotposition< atposition+2 || dotposition+2>=x.length){

      alert(“Please enter a valid e-mail address \n atpostion:”+atposition+”\n dotposition:”+dotposition);

      return false;

      } }

      < /script>

      < body>

      < form name="myform" method="post" action="#" onsubmit="return validateemail();">

      Email: < input type="text" name="email">< br/>

      < input type="submit" value="register">

      < /form>

      24. Explain the requirement of debugging in JavaScript?

      In a browser, there was no error notice for JavaScript. However, these errors may have an impact on the final product. Debugging the code is the best way to figure out what’s wrong. Web browsers such as Google Chrome and Mozilla Firebox can readily examine the program.

      To perform debugging; can use any of the following methods:

      • Using console.log() method
      • Using debugger keyword
    24. Describe the role of a strict mode.

      Silent errors are generated using the JavaScript strict mode. To activate the strict option, it supplies the “use strict”; phrase. Just the first sentence in a procedure can use this phrase.For example:

      “use strict”;



    25. Must Read About Android Tutorial.

      Explain the use of Math object in JavaScript?

      To conduct an arithmetic operation, the JavaScript math object includes numerous parameters and functions. It does not have operators, unlike the status changes. For example,

      function display()





    26. What will be the output of the code below?
      var Y = 1;
      if (function F(){})
      y += TypeofF;< /span>

      Undefined would be the result because the if condition sentence uses eval to
      analyze it, eval(function f()) returns function f() (which is true). The if statement code executed at program execution and the line in the inside of the if condition is assessed at program execution and performing given search inside of the if phrase yields undefined.

    27. Describe how to develop a cookie using JavaScript?

      The easiest way to generate a cookie is to provide the content a string value. Thesyntax cookie entity are as follows:

      document.cookie = “key1 = value1; key2 = value2; expires = date”;

    28. Name the different types of an HTML element that can be accessed in a JavaScript code.

      The type of list of an HTML element can be accessed in a Javascript code in the following ways:

      • getElementById(‘idname’):

        It allows to get an element by its ID name.

      • getElementsByClass(‘classname’):

        It allows to get all the elements which have the given classname.

      • getElementsByTagName(‘tagname’):

        It allows to ge all the elements which have the given tag name.

      • querySelector():

        This function needcss style selector and also returns the first selected element.

    29. Define NaN in JavaScript.

      Not a Number is abbreviated as NaN because any number, even NaN, compares unequally to NaN. It is commonly used to signal an erroneous situation for a method which should produce a legitimate quantity. When a string is attempted to be translated to an integer and it is not possible then get NaN.

    Enroll Yourself in Live Classes For Android training in delhi.

    Copyright 1999- Ducat Creative, All rights reserved.