Explore topic-wise InterviewSolutions in Current Affairs.

This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.

1.

What Is The Use Of “event.stoppropagation” In Jquery?

Answer»

This method is USED to STOP the event bubbling from the child ELEMENTS. It prevents parent being notified to the child EVENTS.

Method – “event.isPropagationStopped()” can be used to CHECK whether method – “stopPropagation” was called or not.

This method is used to stop the event bubbling from the child elements. It prevents parent being notified to the child events.

Method – “event.isPropagationStopped()” can be used to check whether method – “stopPropagation” was called or not.

2.

What Is The Use Of “event.preventdefault” In Jquery?

Answer»

This method is USED to PREVENT the DEFAULT action from happening.

For example:

$("#mycontrolid").CLICK(function(event){

event.preventDefault();

});

This method is used to prevent the default action from happening.

For example:

$("#mycontrolid").click(function(event){

event.preventDefault();

});

3.

What Is The Use Of “clone” Method In Jquery?

Answer»

CLONE” method is used to copy the matched elements. So all its childrens are also being copied along with the PARENT ELEMENT.

For example:

$(document).ready(function(){

$('#mycontrolid').CLICK(function(){

$('#mySpan').clone().prependTo("div");;

return FALSE;

});

});

“clone” method is used to copy the matched elements. So all its childrens are also being copied along with the parent element.

For example:

$(document).ready(function(){

$('#mycontrolid').click(function(){

$('#mySpan').clone().prependTo("div");;

return false;

});

});

4.

Explain The Difference Between “live” And “bind” Methods In Jquery?

Answer»
  • “bind” and “live” methods are USED to attach the events for the controls but there are PROS and cons for each. 
  • “bind” – This method is used to attach the events for the elements which are static. We can not attach the events for the dynamic elements.
  • “live” – “live” method supports dynamic ELEMENT event handling. But it has performance ISSUES if you used all along the PAGE.

5.

How We Can Check/uncheck Radio Buttons In Jquery?

Answer»

Below is the CODE snippet to CHECK/uncheck radio BUTTONS:

// Check #mycontrolid

$('#mycontrolid').attr('checked', TRUE);

// Uncheck #mycontrolid

$('#mycontrolid').attr('checked', false);

Below is the code snippet to check/uncheck radio buttons:

// Check #mycontrolid

$('#mycontrolid').attr('checked', true);

// Uncheck #mycontrolid

$('#mycontrolid').attr('checked', false);

6.

Explain “empty” Method In Jquery?

Answer»

Empty method is generally used to REMOVE the child elements and the text associated to the elements.

For EXAMPLE:

Hi, A4 Academics.

In the above SCENARIO nothing will be shown in UI as all the child controls and text will be removed.

Empty method is generally used to remove the child elements and the text associated to the elements.

For example:

In the above scenario nothing will be shown in UI as all the child controls and text will be removed.

7.

What Are The Differences Between “parents” And “parent” Methods?

Answer»

In DOM structure “parents” METHOD is used to traverse all along the DOM tree, WHEREASPARENT” method is used to traverse only ONE LEVEL.

In DOM structure “parents” method is used to traverse all along the DOM tree, whereas “parent” method is used to traverse only one level.

8.

How We Can Use “each” Function In Jquery?

Answer»

For iterating over objects we will be using this method. Each FUNCTION uses “length” property of the OBJECT INTERNALLY. Index and TEXT of each object can be FETCHED during iteration.

For iterating over objects we will be using this method. Each function uses “length” property of the object internally. Index and Text of each object can be fetched during iteration.

9.

How We Can Check Element Exists Or Not In Jquery?

Answer»

$(DOCUMENT).ready(FUNCTION(){

if ($('# mycontrolid’).length > 0){

//CODE Here if element EXISTS.

});

});

$(document).ready(function(){

if ($('# mycontrolid’).length > 0){

//Code Here if element exists.

});

});

10.

How We Can Check Element Empty In Jquery?

Answer»

$(DOCUMENT).ready(function(){

if ($('#mycontrolid’).is(':empty')){

//CODE here for Empty ELEMENT

}

});

$(document).ready(function(){

if ($('#mycontrolid’).is(':empty')){

//Code here for Empty element

}

});

11.

Explain The Difference Between “this” And “$(this)” In Jquery?

Answer»

“this” REFERS to the current ELEMENT in the scope. “this” will be used in TRADITIONAL JAVASCRIPT and “$(“this”)” if used then we will get the benefits of Jquery METHODS.

For example:

Using “$(this)” -

$(document).ready(function(){

$('#mycontrolid').change(function(){

alert($(this).text());

});

});

Using “this” -

$(document).ready(function(){

$('# mycontrolid'').change(function(){

alert(this.innerText);

});

});

“this” refers to the current element in the scope. “this” will be used in traditional javascript and “$(“this”)” if used then we will get the benefits of Jquery methods.

For example:

Using “$(this)” -

$(document).ready(function(){

$('#mycontrolid').change(function(){

alert($(this).text());

});

});

Using “this” -

$(document).ready(function(){

$('# mycontrolid'').change(function(){

alert(this.innerText);

});

});

12.

Which Providers Will Give Jquery Cdns?

Answer»

Following are the LIST of PROVIDERS gives CDNs for Jquery library:

Following are the list of providers gives CDNs for Jquery library:

13.

Explain The Advantages Of Using Cdns?

Answer»

Below are the advantages of using CDNs:

  • Performance will be IMPROVED as there would not be MUCH load on server.
  • Jquery libraries will be loaded faster.
  • Caching for the Jquery libraries will be ENABLED on USE of CDNs.

Below are the advantages of using CDNs:

14.

What You Mean By Cdn?

Answer»

CDN is KNOWN as – “Content Distribution NETWORK”, which is a network of servers which is deployed in large data center and can be accessed USING INTERNET.

CDN is known as – “Content Distribution Network”, which is a network of servers which is deployed in large data center and can be accessed using internet.

15.

What Is “noconflict” Method In Jquery?

Answer»

JQUERY.Conflict method is USED in case other CLIENT side libraries used along with Jquery then we will USE this method.

Eg: Prototype.js can be used with Jquery and this Prototype.js ALSO uses “$” symbol for accessing the element. So for this purpose we are using Jquery.Conflict method.

Jquery.Conflict method is used in case other client side libraries used along with Jquery then we will use this method.

Eg: Prototype.js can be used with Jquery and this Prototype.js also uses “$” symbol for accessing the element. So for this purpose we are using Jquery.Conflict method.

16.

How To Use Ajax In Jquery?

Answer»

Jquery supports AJAX calls, below is the code snippet of AJAX in Jquery –

$.ajax({

URL: ‘MyURL',

SUCCESS: function(RESPONSE) {

//My Code goes here

},

ERROR: function(err) {

//My Code goes here }

});

Jquery supports AJAX calls, below is the code snippet of AJAX in Jquery –

$.ajax({

url: ‘MyURL',

success: function(response) {

//My Code goes here

},

error: function(err) {

//My Code goes here }

});

17.

What Is The Use Of Jquery Connect?

Answer»

Connect METHOD is used to BIND one function to ANOTHER and it’s used to execute the function when a function is EXECUTED from another OBJECT.

Connect method is used to bind one function to another and it’s used to execute the function when a function is executed from another object.

18.

How Can We Set The Page Title In Jquery?

Answer»

Below is the code snippet USED to set the PAGE TITLE:

$(function(){

$(document).attr(“title”, “A4 ACADEMICS”);

});

Below is the code snippet used to set the page title:

$(function(){

$(document).attr(“title”, “A4 Academics”);

});

19.

What Are The Difference Between “length” And “size” In Jquery?

Answer»

Both are USED to FIND number of elements in an object. “Length” will be used commonly because it’s faster compared to “SIZE” because “length” is a PROPERTY and “size” is a METHOD.

Both are used to find number of elements in an object. “Length” will be used commonly because it’s faster compared to “size” because “length” is a property and “size” is a method.

20.

Can You Give An Example Of Selecting An Element Based On Its Class Name ?

Answer»

Below is the SAMPLE CODE SNIPPET:

$(‘.MyControl’).HIDE()

Below is the sample code snippet:

$(‘.MyControl’).Hide()

21.

What Is The Advantage Of Using Minified Version Of Jquery?

Answer»

Advantage of using minified verison of Jquery will MAINLY be PERFORMANCE. Size of the minified jquery FILE will be AROUND 76KB where as the NORMAL Jquery file size will be around 180KB.

Advantage of using minified verison of Jquery will mainly be performance. Size of the minified jquery file will be around 76KB where as the normal Jquery file size will be around 180KB.

22.

In Asp.net, Jquery Will Be Added In Content And Master Pages Both?

Answer»

No. If the JQUERY FILE added in master page then CONTENT pages will GOING to USE that.

No. If the Jquery file added in master page then content pages will going to use that.

23.

What Is The Meaning Of Selectors In Jquery?

Answer»

In JAVASCRIPT we have several METHODS to find the controls like – “getElementByName” and “getElementByID”, which is used to find the control BASED on Name of the control and ID of the control RESPECTIVELY. Similarly in Jquery we have find the controls using selectors. Below are some of the selectors -

  • “*” - To Find all the elements of the page.
  • “#” – Used to find the control by ID.
  • “.” - Used to find the control by Class.

In javascript we have several methods to find the controls like – “getElementByName” and “getElementByID”, which is used to find the control based on Name of the control and ID of the control respectively. Similarly in Jquery we have find the controls using selectors. Below are some of the selectors -

24.

How To Show The Alert Message On Button Click In Jquery?

Answer»

Jquery is one of the most POWERFUL libraries what we have and it provides event HANDLING. This scenario can be handled by “ONCLICK” of the BUTTON. Below is the code snippet –

<input TYPE=”button” id=”myButton” onclick=”alert(‘Hi’)” />

Jquery is one of the most powerful libraries what we have and it provides event handling. This scenario can be handled by “OnClick” of the button. Below is the code snippet –

<input type=”button” id=”myButton” onclick=”alert(‘Hi’)” />

25.

How We Can Hide And Show The Controls In Jquery?

Answer»

ACCESS the control USING ‘$’ and use the methods “Hide()” and “SHOW()” LIKE below.

For example:

$(‘#MyControl’).Hide()

$(‘#MyControl’).Show()

Access the control using ‘$’ and use the methods “Hide()” and “Show()” like below.

For example:

$(‘#MyControl’).Hide()

$(‘#MyControl’).Show()

26.

Why We Can Use Jquery In Our Application?

Answer»

Below are the main reasons where we can use Jquery:

Below are the main reasons where we can use Jquery:

27.

What Are The Differences Between “body.onload” And “document.ready” Methods?

Answer»
  • “body.onload” method will be used only once in a page where as “document.READY” method can be used MULTIPLE TIMES in a same page. “body.onload” method will be called once all the resources of the page are loaded. (images, CSS and DOM).
  • But “document.ready” method called once DOM is ready and it does not wait TILL other resources are loaded.

28.

What Is The Significance Of ‘$’ Sign In Jquery?

Answer»

‘$’ is USED as an ALIAS for JQUERY.

Below are the EXAMPLES of how we can use it:

Eg: $(‘#MyControl’)

‘$’ is used as an alias for jquery.

Below are the examples of how we can use it:

Eg: $(‘#MyControl’)

29.

Explain Difference Between Jquery And Javascript?

Answer»

QUERY is a LIBRARY and Javascript is a LANGUAGE and Jquery provides full-fledged SUPPORT for javascript language.

query is a library and Javascript is a language and Jquery provides full-fledged support for javascript language.

30.

How We Can Use Jquery In Asp.net?

Answer»

We can USE Jquery by downloading the jquery and use it in our PROJECT or can use CDNs available from Google, Microsoft and GIVE the CDN URL in ASPX PAGE.

We can use Jquery by downloading the jquery and use it in our project or can use CDNs available from Google, Microsoft and give the CDN URL in ASPX page.

31.

Explain We Can Use Jquery?

Answer»

JQUERY can be used ALONG with other libraries. It works with SIMPLE and complex JAVASCRIPT and AJAX.

Jquery can be used along with other libraries. It works with simple and complex javascript and AJAX.

32.

What Is Jquery?

Answer»

Jquery is JAVASCRIPT library and it is used for HTML DOM ACCESS (MANIPULATING and traversing of HTML DOM elements). It PROVIDES most powerful feature of event HANDLING as well.

Jquery is javascript library and it is used for HTML DOM access (manipulating and traversing of HTML DOM elements). It provides most powerful feature of event handling as well.