Friday 6 February 2015

PHP, Mysql, Javascript Interview asking Question and Answer (Page4)

31. Which version of jQuery file should be used?
In most of the recent releases so far, the core functionality of jQuery remains same however some more cool and better features are added. Ideally you should use the latest jQuery files available on the jQuery.com website. By doing this you ensure that your earlier functionality will still work and you can use new features available as part of the new release.

32. What are Selectors in jQuery mean ?
Generally in HTML, if we need to work with any control on a web page we need to find the control. For that we use document.getElementByID or document.getElementByName. But in jquery we do it using Selectors.
Using this selectors we can select all the controls as well using a symbol (* )
A sample code snippet can be of this form
<script language="javascript" type="text/javascript">
$("*").css("border", "10px red");
</script>

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

34. What is the advantage of using the minified version of JQuery rather than using the conventional one?
The advantage of using a minified version of JQuery file is Efficiency of the web page increases.
The normal version jQuery-x.x.x.js has a file size of 178KB
but the minified version jQuery.x.x.x-min.js has 76.7 KB.
The reduction in size makes the page to load more faster than you use a conventional jQuery file with 178KB.

35. What is CDN and how jQuery is related to it?
CDN - It stands for Content Distribution Network or Content Delivery Network.
Generally, a group of systems at various places connected to transfer data files between them to increase its bandwidth while accessing data. The typical architecture is designed in such a way that a client access a file copy from its nearest client rather than accessing it from a centralized server.
So we can load this jQuery file from that CDN so that the efficiency of all the clients working under that network will be increased.
Example :
We can load jQuery from Google libraries API
<script type="text/javascript" language="Javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>

36. Can we select a element having a specific class in jQuery ?
Yes, we can select an element with a specific class, we use the class selector.The class name must contain the prefix as "." (dot).
<script language="javascript" type="text/javascript">
         $(".class1").css("border", "2px solid red");
</script>

37. What are features of JQuery or what can be done using JQuery?
Features of Jquery
1. One can easily provide effects and can do animations.
2. Applying / Changing CSS.
3. Cool plugins.
4. Ajax support
5. DOM selection events
6. Event Handling

38. What are the advantages of JQuery ?
There are many advantages with JQuery. Some of them are :
. It is more like a JavaScript enhancement so there is no overhead in learning a new syntax.
. It has the ability to keep the code simple, readable, clear and reusable.
. It would eradicate the requirement for writing complex loops and DOM scripting library calls.
More Questions & Answers :-
Page1  Page2  Page3  Part4

No comments:

Post a Comment