TOP 50 JQUERY INTERVIEW QUESTIONS ANSWERS FOR EXPERIENCED SET - 2

This is our second article which containing 20 jquery/ajax interview questions answers. Our previous article containing 30 jquery frequently asked interview questions. If you have not read first set then click here for read FIRST SET 1-30.

TOP 50 JQUERY INTERVIEW QUESTIONS ANSWERS FOR 3-5 YEARS EXPERIENCED

Q-31).What is difference between jQuery's ready and holdReady?
 jQuery's ready is an event which gets triggered automatically when DOM is ready while holdReady is a signal/flag to hold this triggering. holdReady was included in 1.6 version and it works only if used before the execution/triggering of ready event. Once ready event is fired, it has nothing to do. It is useful in dynamically loading scripts before the ready starts. It release ready event execution when used with a true parameter.

Q-32).What is Jquery $.ajax() method?
 The Jquery ajax() method is used to perform an AJAX (asynchronous HTTP) request.

Q-33).Name any four paremeter of Jquery ajax method?
 url : Specifies the URL to send the request to. Default is the current page
 type : Specifies the type of request. (GET or POST)
 data : Specifies data to be sent to the server
 cache: A Boolean value indicating whether the browser should cache the requested pages. Default is true beforeSend(xhr): A function to run before the request is sent

Q-34).When can you use jQuery?
 JQuery can be used to perform
 1.Call methods on specific events
 2.Traverse the documents
 3.For apply CSS
 4.Manipulation purpose and
 5.To add effects too.
 6.For apply animations
 7.For give atractive look (dialogbox etc)
 8.For asynchronous calls ($.ajax())

Q-35).What is the use of noConflict() method in Jquery?

Q-36).How to select combobox selecte value and text using Jquery?
 Example:
var StateID = $("#StateCbx").val(); // Or you can use it $("#iStateID").val();
var StateName = $("#StateCbx option:selected").text();
alert("Selected combobox text is= " + StateName + " and value is= " + StateID);

Q-37).JQuery html() method works for both HTML and XML documents?
 No, It only works for HTML

Q-38).Can you call C# codebehind method using Jquery?
 Yes

Q-39).How can you call a method inside code-behind using jQuery?
 By $.ajax and by declaring method a WebMethod

Q-40).What is the use of jQuery.data()?
 jQuery’s data method gives us the ability to associate arbitrary data with DOM nodes and JavaScript objects. This makes our code more concise and clean.
 For live example click here http://tutorialzine.com/2010/11/jquery-data-method/

Q-41).Is jQuery a W3C standard?
 No

Q-42).What is the use of jquery .each() function?
 Basically, the jQuery .each() function is used to loop through each element of the target jQuery object. Very useful for multi element DOM manipulation, looping arrays and object properties.
 Example:-
 In this example alert box will open 3 times because dom contain 3 <li> tags

<script>
    $(document).ready(function () {
        $("button").click(function () {
            $("li").each(function () {
                alert($(this).text())
            });
        });
    });
 </script>

 <ul>
 <li>Coffee</li>
 <li>Milk</li>
 <li>Soda</li>
 </ul>


Q-43).If you have a server control(asp.net server control, Button) and on the click of button you want to call a jquery function, So how you will call a jquery function without postback?
 ASP.NET provides the OnClientClick property to handle button clicks. You can use this property on Button, LinkButton and ImageButton. The same OnClientClick property also allows you to cancel a postback.
 So I can use OnClientClick property and Jquery function will return false.
 Example
<script type="text/javascript">
    function callMe() {
        alert('Hello');
        return false;
    }
 </script>
 <asp:Button ID="Button1" runat="server" OnClientClick="return callMe();" Text="Button" />


Q-44).What is the use of .Size() method in Jquery?
 Jquery's .size() method returns number of element in the object. That means that you can count the number of elements within an object.

Q-45).What is the difference between jquery.size() and jquery.length?
 Jquery.size() and jquery.length both returns the number of element found in the object. But, jquery.length is faster than jquery.size() because size() is a method but length is a property.

Q-46).How you can debug Jquery code/What are the technique to debug jquery?
 Add the keyword "debugger;" to the line from where we want to start the debugging and then run the Visual Studio in Debug mode by pressing F5 or using the Debug button.

Q-47).Difference between jQuery-x.x.x.js and jQuery.x.x.x min.js?
 jQuery-x.x.x.js = Pretty and easy to read Smile Read this one.
 jQuery.x.x.x min.js = Looks like jibberish! But has a smaller file size. Put this one on your site for fast loading and less size.

Q-48).How to get the server response from an AJAX request using Jquery?
 When invoking functions that have asynchronous behavior We must provide a callback function to capture the desired result. This is especially important with AJAX in the browser because when a remote request is made, it is indeterminate when the response will be received.
Below an example of making an AJAX call and alerting the response (or error):
     $.ajax({
         url: 'pcdsEmpRecords.php',
         success: function (response) {
             alert(response);
         },
         error: function (xhr) {
             alert('Error! Status = ' + xhr.status);
         }
     });


Q-49).Do we need to add the JQuery file both at the Master page and Content page as well?
 No, if the Jquery file has been added to the master page then we can access the content page directly without adding any reference to it.
 This can be done using this simple example
<script type="text/javascript" src="jQuery-1.4.1-min.js"></script>

Q-50).Difference between onload() and document.ready() function used in jQuery?
 We can add more than one document.ready() function in a page.
 we can have only one onload function.
 Document.ready() function is called as soon as DOM is loaded.
 body.onload() function is called when everything (DOM, images)gets loaded on the page.

Q-51). Explain how you will freeze an object in javascript?

CLICK HERE FOR READ FROM START (Questions 1-30)

Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. good collection..

    ReplyDelete
  3. Thanks for sharing top JavaScript interview questions, and I have recently find the collection of frequently asked JavaScript interview question and answer for beginner and advanced label. these questions and answers will help you prepare for you interviews in different companies. http://goo.gl/S7wdGg

    ReplyDelete
  4. Compare to JAVASCRIPT using JQUERY we can design better performance applications. JQUERY comes with many in-built functions. Which saves programmer time. Rather focus into Core development you can utilize your time to develop functionalities. This is the cause why JQUERY is so popular. Are you among them who is going to attained a Walk-in interview on this Saturday? If so please visit http://jharaphula.com/top-jquery-interview-questions-with-answers. Here you can get all kind of possible interview Questions for JQUERY.

    ReplyDelete
  5. Really there all are question will help you to crack interview

    ReplyDelete
  6. Really there all are question will help you to crack interview

    ReplyDelete
  7. Its looks easy for beginners to understand the power of JQuery.

    I have found few more interesting questions here

    ReplyDelete

Archive

Contact Form

Send