December 06, 2019

Top 20 JQuery Interview Questions and Answers



Ques: 1. How JQuery and JavaScript are different?

Answer:

JQuery simplifies the use of the JavaScript language. JavaScript is a language while JQuery is a library built in the JavaScript language that helps to use the JavaScript language.



AngularJS Interview Questions and Answers


Ques: 2. Can JQuery fulfill the need JavaScript?

Answer:

JQuery is not a replacement of JavaScript. JQuery is a different library which is written on the top of JavaScript. JQuery is a lightweight JavaScript library that emphasizes interaction between JavaScript and html.


AJAX interview Questions and Answers



Ques: 3. What are the effects methods used in JQuery?

Answer:

JQuery enables us to add effects on a web page. JQuery effects can be categorized into fading, sliding, hiding/showing and animation effects. JQuery provides many methods for effects on a web page. These are the effects methods used in JQuery:
    show() - It displays or shows the selected elements.
    hide() - It hides the matched or selected elements.
    toggle() - It shows or hides the matched elements. In other words, it toggles between the hide() and show() methods.
    fadeIn() - It shows the matched elements by fading it to opaque. In other words, it fades in the selected elements.
    fadeOut() - It shows the matched elements by fading it to transparent. In other words, it fades out the selected elements.


JavaScript Interview Questions and Answers



Ques: 4. What is the function of ajaxComplete() as JQuery Ajax event method?

Answer:

Whenever an Ajax request completes, JQuery triggers the ajaxComplete event. Any and all handlers that have been registered with the .ajaxComplete() method are executed at this time.


Node.js Interview Questions and Answers


Ques: 5. What is the difference between the ID selector and class selector in JQuery?

Answer:

ID selector and class selector are the same as they are in CSS. ID selector uses ID while the class selector uses a class to select elements. You use an ID selector to select just one element. If you want to select a group of elements, having the same CSS class, you can use the class selector.


Advance Java interview Questions and Answers


Ques: 6. What does dollar sign ($) mean in JQuery?

Answer:

Dollar sign is nothing but it's an alias for JQuery. Take a look at below JQuery code.

$(document).ready(function(){
});

over here $ sign can be replace with JQuery keyword.

JQuery(document).ready(function()){
});


Ques: 7. What is the difference between body.onload() and document.ready() function?

Answer:

Document.ready() function is different from body.onload() function for 2 reasons:
1. we can have more than one document.ready() function in a page where we can have only one body.onload() function.
2. document.ready() function is called as soon as DOM is loaded where body.onload() function is called when everything gets loaded on the page that includes DOM, images and all associated resources of the page.


Ques: 8. What is JQuery UI?

Answer:

JQuery UI is a set of user interface interactions, effects, widgets, and themes built on top of the JQuery JavaScript Library. JQuery UI works well for highly interactive web applications with many controls or for a simple page with a date picker control.


Ques: 9. What is the advantage of hosting a JQuery using a CDN?

Answer:

CDN stands for Content Delivery Network or Content Distribution Network. It is a large distributed system of servers deployed in multiple data centres across the internet. It provides the files from servers at a higher bandwidth that leads to faster loading time.

Advantages of using CDN are:

·       The JQuery library download time will be reduced. For example - Users in Europe will hit the CDN in Europe and users in the US will hit the US CDN. As a result, this will reduce the overall page load time.

·       The JQuery library will already be cached in the user’s browser if the user visited another website that references the same JQuery library. In this case, the user need not download the JQuery library.


Ques: 10. What is the difference between find and children methods?

Answer:

Both the methods are used to filter the child of the matched elements. Find method is used to find all levels down the DOM tree but children method searches only a single level down the DOM tree.


Ques: 11. What do you understand by JQuery.noConflict?

Answer:

JQuery no-conflict is an option given by JQuery to overcome the conflicts between the different js frameworks or libraries. When we use JQuery no-conflict mode, we are replacing the $ to a new variable and assigning to JQuery some other JavaScript libraries. Also use the $ (Which is the default reference of JQuery) as a function or variable name what JQuery has. And in our development life, we are not at all strict to only JQuery.


Ques: 12. Why there are two different version of JQuery library?

Answer:

JQuery library comes in 2 different versions:

1). Production
2). Deployment

The production version is quite useful at development time as JQuery is open source and if you want to change something then you can make those changes in production version.

But the deployment version is small version or compressed version so it is impossible to make changes in it. because it is compressed, so its size is very less than the production version which affects the page load time.


Ques: 13. Which are the popular JQuery CDN? and what is the advantage of using CDN?

Answer:

There are 3 popular JQuery CDNs:
1. Google
2. Microsoft
3. JQuery

Advantage of using CDN.
1. It reduces the load from your server.
2. It saves bandwidth. JQuery framework will load faster from these CDN.
3. The most important benefit is it will be cached, if the user has visited any site which is using JQuery framework from any of these CDN.


Ques: 14. How to remove a DOM Element using JQuery?

Answer:

Sometimes we get a requirement to delete all child nodes and remove DOM elements using JQuery to make a dynamic web page. In this scenario JQuery provides a couple of methods to remove DOM elements. Here are the options:

    empty()
    remove()
    html()


Ques: 15. What are JQuery Events?

Answer:

When we design dynamic web pages, we need to apply some events such as Mouse Click, for forms submit the form after a button click, change a color after a click, etc.

So in layman language, events are actions that are used for dynamic web pages. When we perform these actions on an HTML page, we can do whatever we want.

We use some event handlers to perform the action. Some important handlers are bind(), unbind(), blur(), off(), hover(), on(), one(), ready(), trigger() etc.


Ques: 16. What is Grouping?

Answer:

When more than one selector shares the same declaration, they may be grouped together via a comma-separated list; this allows you to reduce the size of the CSS (every bit and byte is important) and makes it more readable. The following snippet applies the same background to the first three heading elements.h1, h2, h3 {background: red;}


Ques: 17. What do you mean by Semantic HTML?

Answer:

Semantic HTML is a coding style where the tags embody what the text is meant to convey. In Semantic HTML, tags like <b></b> for bold, and <i></i> for italic should not be used, reason being they just represent formatting, and provide no indication of meaning or structure. The semantically correct thing to do is use <strong></strong> and <em></em>. These tags will have the same bold and italic effects, while demonstrating meaning and structure (emphasis in this case).


Ques: 18. What is the difference between eq() and get() methods in JQuery?

Answer:

eq() returns the element as a JQuery object. This method constructs a new JQuery object from one element within that set and returns it. That means that you can use JQuery functions on it.

get() return a DOM element. This method retrieves the DOM elements matched by the JQuery object. But as it is a DOM element and it is not a JQuery-wrapped object. So JQuery functions can't be used.


Ques: 19. What is difference between prop and attr?

Answer:

attr(): Get the value of an attribute for the first element in the set of matched elements. Whereas,.prop(): (Introduced in JQuery 1.6) Get the value of a property for the first element in the set of matched elements.

Attributes carry additional information about an HTML element and come in name="value" pairs. Where Property is a representation of an attribute in the HTML DOM tree. once the browser parse your HTML code, corresponding DOM node will be created which is an object thus having properties.

attr() gives you the value of element as it was defines in the html on page load. It is always recommended to use prop() to get values of elements which is modified via javascript/JQuery , as it gives you the original value of an element's current state. Find out more here.


Ques: 20. Can we execute/run multiple Ajax request simultaneously in JQuery?

Answer:

Yes, it is possible to execute multiple Ajax request simultaneously or in parallel. Instead of waiting for first ajax request to complete and then issue the second request is time consuming. The better approach to speed up things would be to execute multiple ajax request simultaneously.

Using JQuery.when() method which provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.

 

 

 

December 02, 2019

Top 20 PHP Interview Questions and Answers



Ques: 1) What is CAPTCHA?

Answer: 

CAPTCHA stands for Completely Automated Public Turing Test to tell Computers and Humans Apart. To prevent spammers from using bots to automatically fill out forms, CAPTCHA programmers will generate an image containing distorted images of a string of numbers and letters. Computers cannot determine what the numbers and letters are from the image but humans have great pattern recognition abilities and will be able to fairly accurately determine the string of numbers and letters. By entering the numbers and letters from the image in the validation field, the application can be fairly assured that there is a human client using it.

 

BlockChain interview Questions and Answers

 

Ques: 2) What is meant by urlencode() and urldecode()?

Answer:

string urlencode(str)

When str contains a string like this “hello world” and the return value will be URL encoded and can be use to append with URLs, normally used to append data for GET like someurl.com?var=hello%world

string urldocode(str)

This will simple decode the GET variable’s value. Example: echo (urldecode($_GET_VARS[var])) will output “hello world”

 

C language Interview Questions and Answers

 

Ques: 3) What is difference between mysql_fetch_array(), mysql_fetch_row() and mysql_fetch_object()?

Answer:

mysql_fetch_array - Fetch the all matching records of results.

mysql_fetch_object - Fetch the first single matching record of results.

mysql_fetch_row - fetches a result row as array.

 

C++ language Interview Questions and Answers

 

Ques: 4) What is difference between srand & shuffle?

Answer:

The srand function seeds the random number generator with seed and shuffle is used for shuffling the array values.

shuffle - This function shuffles (randomizes the order of the elements in) an array. This function assigns new keys for the elements in array. It will remove any existing keys you may have assigned, rather than just reordering the keys.

srand - Seed the random number generator

 

Machine Learning Interview Questions and Answers

 

Ques: 5) How do you capture audio/video in PHP?

Answer:

You need a module installed - FFMPEG. FFmpeg is a complete solution to record, convert and stream audio and video. It includes libavcodec, the leading audio/video codec library. FFmpeg is developed under Linux, but it can be compiled under most operating systems, including Windows.

 

MySQL Interview Questions and Answers

 

Ques: 6) What's the difference between COPY OF A FILE & MOVE_UPLOAD_FILE in file uploading?

Answer:

Move: This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.

If filename is not a valid upload file, then no action will occur, and move_uploaded_file() will return FALSE.

Copy: Makes a copy of a file. Returns TRUE if the copy succeeded, FALSE otherwise.

 

PowerShell Interview Questions and Answers

 

Ques: 7) What is the difference between echo and print?

Answer:

Main difference between echo() and print() is that echo is just an statement not a function and doesn't return's value or it just prints a value whereas print() is an function which prints a value and also it returns value.

We cannot pass arguments to echo since it is just a statement whereas print is a function and we can pass arguments to it and it returns true or false. print can be used as part of a more complex expression whereas echo cannot. echo is marginally faster since it doesn't set a return value.

 

Python Interview Questions and Answers

 

Ques: 8) What is the difference between require() and include()?

Answer:

Both of these constructs includes and evaluates the specific file. The two functions are identical in every way except how they handle failure. If filepath not found, require() terminates the program and gives fatal error, but include() does not terminate the program; It gives warning message and continues to program.

include() produces a Warning while require() results in a Fatal Error if the filepath is not correct.

 

Python Pandas Interview Questions and Answers


Ques: 9) How do we know properties of the browser?

Answer:

You can gather a lot of information about a person's computer by using $_SERVER['HTTP_USER_AGENT']. This can tell us more about the user's operating system, as well as their browser. For example I am revealed to be Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418 (KHTML, like Gecko) Safari/417.9.3 when visiting a PHP page.

This can be useful to programmers if they are using special features that may not work for everyone, or if they want to get an idea of their target audience. This also is important when using the get_browser() function for finding out more information about the browser's capabilities. By having this information the user can be directed to a version of your site best suited to their browser.

get_browser() attempts to determine the capabilities of the user's browser. This is done by looking up the browser's information in the browscap.ini file.

echo $_SERVER['HTTP_USER_AGENT'] . "<hr />\n";

$browser = get_browser();

foreach ($browser as $name => $value)  { echo "<b>$name</b> $value <br />\n";

 }

 

SQL Server Interview Questions and Answers

 

Ques: 10) What is difference between require_once(), require(), include(). Because all these function are used to call a file in another file.

Answer:

Difference between require() and require_once(): require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page).

So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don't include the file more times and you will not get the "function re-declared" error.

Difference between require() and include() is that require() produces a FATAL ERROR if the file you want to include is not found, while include() only produces a WARNING.

There is also include_once() which is the same as include(), but the difference between them is the same as the difference between require() and require_once().

 

Unix interview Questions and Answers

 

Ques: 11) What are the different types of errors in PHP?

Answer:

1. Notices: These are trivial, non-critical errors that PHP encounters while executing a script - for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all - although you can change this default behavior.

2. Warnings: These are more serious errors - for example, attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination.

3. Fatal errors: These are critical errors - for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP’s default behavior is to display them to the user when they take place.

 

C# Language Interview Questions and Answers

 

Ques: 12) How to Create a Cookie & destroy it in PHP?

Answer:

setcookie(”variable”,”value”,”time”);

variable - name of the cookie variable variable - value of the cookie variable time - expiry time

Example: setcookie(”test”,$i,time()+3600);

Test - cookie variable name

$i - value of the variable ‘Test’ time()+3600 - denotes that the cookie will expire after an one hour.

Destroy a cookie by specifying expiry time

Example: setcookie(”test”,$i,time()-3600); // already expired time

Reset a cookie by specifying its name only

setcookie(”test”);

 

CSS (Cascading Style Sheets ) Interview Questions and Answers

 

Ques: 13) What is the difference between the functions unlink and unset?

Answer:

unlink is a function for file system handling. It will simply delete the file in context. unset will set UNSET the specified variable.

unlink is used to delete a file. unset is used to destroy an earlier declared variable.

 

Robotic Process Automation(RPA) Interview Questions and Answers

 

Ques: 14) How do you know (status) whether the recipient of your mail had opened the mail i.e. read the mail?

Answer:

Embed an URL in a say 0-byte image tag may be the better way to go. In other word, you embed an invisible image on you html email and when the src URL is being rendered by the server, you can track whether your recipients have view the emails or not.

 

UX Design Interview Questions and Answers

 

Ques: 15) What is difference between mysql_connect and mysql_pconnect?

Answer:

mysql_connect opens up a database connection every time a page is loaded. mysql_pconnect opens up a connection, and keeps it open across multiple requests.

mysql_pconnect uses less resources, because it does not need to establish a database connection every time a page is loaded.

 

Docker Interview Questions and Answers

 

Ques: 16) What do you need to do to improve the performance (speedy execution) for the script you have written?

Answer:

If your script is to retrieve data from Database, you should use "Limit" syntax. Break down the non dynamic sections of website which need not be repeated over a period of time as include files.

 

Google Cloud Computing Interview Questions and Answers

 

Ques: 17) How do you insert single & double quotes in MySQL db without using PHP?

Answer: 

By using &amp; / &quote;

Alternately, escape single quote using forward slash \' . In double quote you don't need to escape quotes. Insert double quotes as "".

 

Azure Interview Questions and Answers

 

Ques: 18) What is the difference between strstr & stristr?

Answer:

For strstr, the syntax is: string strstr(string $string,string $str ); The function strstr will search $str in $string. If it finds the string means it will return string from where it finds the $str upto end of $string.

For Example:

$string = "http://yahoomail.com"; $str="yahoomail";

The output is "yahoomail.com". The main difference between strstr and stristr is of case sensitivity. The former consider the case difference and later ignore the case difference.

 

Linux Interview Questions and Answers

 

Ques: 19) What is the difference between explode and split?

Answer:

Split function splits string into array by regular expression. Explode splits a string into array by string.

For Example:

explode(" and", "India and Pakistan and Srilanka"); split(" :", "India : Pakistan : Srilanka");

Both of these functions will return an array that contains India, Pakistan, and Srilanka.

 

Data Science Interview Questions and Answers

 

Ques: 20) How can you avoid execution time out error while fetching record from MySQL?

Answer:

set_time_limit -- Limits the maximum execution time

For Example:

set_time_limit(0);

If you set to 0 you say that there is not limit.

 

Edge Computing Interview Questions and Answers

 


More Interview Questions and Answers:


Hadoop Technical Interview Questions and Answers

 

Hyperion Technical Interview Questions and Answers

 

Internet of Things (IOT) Interview Questions and Answers

 

C# Language Interview Questions and Answers