HTML

html content help to improve the coding

Tuesday, 19 July 2016

Most Commonly asked UI Interview Question

1) What is ‘this’ keyword in JavaScript?
-->This’ keyword refers to the object from where it was called.


2)Explain the working of timers in JavaScript? Also elucidate the drawbacks of using the timer, if any?
->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.

3)Which symbol is used for comments in Javascript?


-> // for Single line comments and
 /*   Multi
 Line omment
 */

4)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.


5)Explain how can you submit a form using JavaScript?
-> To submit a form using JavaScript use document.form[0].submit();
    document.form[0].submit();


6)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.


7)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.


8)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.


9)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


10)What are all the types of Pop up boxes available in JavaScript?
-> •Alert
   •Confirm and
   •Prompt


11)What is the data type of variables of in JavaScript?
-> All variables in the JavaScript are object data types.


12)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.


13)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.


14)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


15)What is the use of blur function?
-> Blur function is used to remove the focus from the specified object.


16)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.


17)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.


18)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.


19)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.


20)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.


21)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();


22)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.


23)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”


24)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.


25)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.


26)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.


27)What are Screen objects?
-> Screen objects are used to read the information from the client’s screen. The properties of screen objects are –
 •AvalHeight: 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


JQUERY

28)What is live() AND .bind() Method.
-> .bind() attacheds events to elements that exist or match the selector at the time the call is made. Any elements created afterwards or that match going forward because the class was changed, will not fire the bound event.
   .live() works for existing and future matching elements. Before jQuery 1.4 this was limited to the following events: click, dblclick mousedown, mouseup, mousemove, mouseover, mouseout, keydown, keypress, keyup.


29)The element Selector
-> The jQuery element selector selects elements based on the element name.
    You can select all <p> elements on a page like this:
   The #id Selector
    The jQuery #id selector uses the id attribute of an HTML tag to find the specific element.
    An id should be unique within a page, so you should use the #id selector when you want to find a single, unique element.
    To find an element with a specific id, write a hash character, followed by the id of the element:
     $(“#test”)
   The .class Selector
   The jQuery class selector finds elements with a specific class.
    To find elements with a specific class, write a period character, followed by the name of the class:
    $(“.test”)


30)What is The sessionStorage Object.
-> The sessionStorage object is equal to the localStorage object, except that it stores the data for only one session. The data is deleted when the user closes the browser window.
   The following example counts the number of times a user has clicked a button, in the current session:
    Example
 if (sessionStorage.clickcount)
  {
  sessionStorage.clickcount=Number(sessionStorage.clickcount)+1;
  }
  else
  {
  sessionStorage.clickcount=1;
  }
  document.getElementById(“result”).innerHTML=”You have clicked the button ” + sessionStorage.clickcount + ” time(s) in this session.”;


BOOTSTRAP:


31)What is bootstrap?
->Bootstrap is an open-source Javascript framework developed by the team at Twitter. It is a combination of HTML, CSS, and Javascript code designed to help build user interface components. Bootstrap was also programmed to support both HTML5 and CSS3.
  Important! Bootstrap is a CSS and Javascript framework that is used within your HTML. Bootstrap provides more advanced functionality to your web site. Generally, if you are not a developer you do not need to worry about bootstrap.

32)What is included with Bootstrap?
-> If you were to download bootstrap, you would find that it includes css files, javascript files, and images. Here’s a sneak peak at the files included:

 Css
 bootstrap.css
 bootstrap.min.css
 bootstrap-responsive.css
 bootstrap-responsive.min.css
 img  
 glyphicons-halflings.png
 glyphicons-halflings-white.png
 js
 bootstrap.js
 bootstrap.min.js







No comments:

Post a Comment