Google News
UI Developer Interview Questions
Lazy loading is a design pattern and optimization technique used in computer programming to delay the initialization of an object until a required period. It is also known as on-demand loading. This optimization technique is used for online content like a website or a web app. It is used to enhance the performance of the web page. In this technique, instead of loading the entire web page and rendering it to the user in one go as in bulk loading, only the required section is loaded, and it delays the remaining part of the web page until the user requires it.
Advantages of Lazy loading
* Lazy loading or on-demand loading enhances the performance of web pages by reducing time consumption and memory usage.
* It optimizes the content delivery on the web page.
* It loads only a fraction of the web page first, which is required. Thus, the time taken is less, and the loading of the rest of the part of the web page is delayed, which saves storage.
* It enhances the user's experience as the requested content is delivered quickly.
* It avoids unnecessary code execution.
* It is cost-effective as it practices the optimal time and space resources usage.

Disadvantages of Lazy loading
* The developers have to add some extra lines of code to the existing ones to implement lazy load. It can make the code a bit complicated.
* Sometimes, lazy loading may affect the website's ranking on search engines because of improper indexing of the content, which is not loaded.
Attributes are an element of an HTML document while properties are a part of the Document Object Model (DOM).
Example : <input type="text" value="Tech">
Here, value and type are the attributes of HTML, but when the statement is read by the browser and parses this code it will make a DOM with different properties, like accept, autofocus, accessKey, baseURI, checked, childElementCount, align, alt, childNodes, children, classList, className, attributes, and clientHeight.
Example :
var data = document.querySelector(input);  // here we created a document object of input tag
console.log(input.getAttribute('value')); // tech  // getting the attribute value
console.log(input.value); // tech   // getting the property of the input object
Node js is an open-source virtual machine that uses javascript as its scripting language. Despite being single-threaded, it is one of the most popular web technologies. The reason why node js is popular despite being single-threaded is the asynchronous nature that makes it possible to handle concurrency and perform multiple I/O operations at the same time. Node js uses an event loop to maintain concurrency and perform non-blocking I/O operations.
As soon as Node js starts, it initializes an event loop. The event loop works on a queue (which is called an event queue) and performs tasks in FIFO(First In First Out) order. It executes a task only when there is no ongoing task in the call stack. The call stack works in LIFO(Last In First Out) order. The event loop continuously checks the call stack to check if there is any task that needs to be run. Now whenever the event loop finds any function, it adds it to the stack and runs in order.  
Let’s see an example to get a proper understanding of how to call stack and event loop works and handles concurrency,
Example : In this example, we will see the working of the call stack.
function add(a,b){
   return a+b;
function print(n){
   console.log(`Two times the number ${n} is `+add(n,n));

Output : 

Two times the number 5 is 10
== denotes abstract equality operator, and it inspects if two values are equal or not apart from their data types. Automatically, it transforms the type of both the operands and compares them.
Example : 
1=='1';    //true
1==1;   // true
=== denotes identity equality operator, and it inspects the values of both the operands and their data type. The outcome of the operation will be true considering both the operands are equal and have the same data type, or else it returns false.
Example : 
1===1   //true
1==='1'   // false
Tags and attributes are two concepts used in HTML. They work together but perform different functions. The main difference between an HTML tag and an HTML attribute is that an HTML tag is a way of representing an HTML element in the program. On the other hand, an HTML attribute describes the characteristics of an HTML element.

For example : <a>, <href>, <button>, and <div> etc. are HTML tags and src, class, and id etc. are the example of HTML attributes.
See this example :
<img src="myhome.jpg" alt="A photo of my home.">  
In the above example, the image source (src) and the alt text (alt) are attributes of the <img> tag.
Difference between HTML tags and HTML attributes :

HTML Tags HTML Attributes
HTML tags are generally the starting and ending parts of the HTML code. HTML attributes are used to define the character of the HTML elements.
HTML tags define a way to represent and hold HTML elements in the program. HTML attributes are generally used to provide additional styling to the element.
HTML tags begin with < symbol and end with > symbol. HTML attributes are always placed in the opening tag of an element.
HTML tags are like keywords where every single tag has a unique meaning. HTML attributes provide various additional properties to the existing HTML element.
HTTP Requests Description
GET It is sent when we wish to recover data from the server. GET request is the most typically used HTTP request.
HEAD The HEAD is a reaction that is the same as the GET request but doesn’t possess a message-body in the response. The HEAD request method is beneficial in retrieving meta-data that is documented as per the headers, without transferring the entire content. The method is commonly utilised when testing hypertext links for recent change, accessibility, and validity.
TRACE TRACE requests are implemented to invoke a remote, application loop-back test along the path to the target resource. The TRACE method lets users to witness whatever message is being received at the other end of the request chain so that they can utilise the data for testing or diagnostic functions.
POST This request is utilized to transmit data from the user to the server. By submitting web forms, these requests can be made. The POST request is generally utilized to build data in the database.
For instance, when we build a new account on any webpage, we make use of the POST request.
PUT It is identical to POST, but it is utilized to revise the existing data on the server. For instance, when we wish to revamp our complete account on a web page, we utilize the PUT request.
PATCH It is identical to PUT and is utilized when we wish to revise a certain field of our data. For instance, when we just wish to update our name or any additional information about our account, we can make use of the PATCH request.

HTTP Status codes Description
HTTP Status Code 301 - Permanent Redirect Any time one URL needs to be redirected to another permanently, a 301 redirect should be used. A 301 redirect implies that bots and visitors that come on that page will be taken to the new URL. Link equity is also passed to the new URL via a 301 redirect. 
HTTP Status Code 302 - Temporary Redirect  302 redirect is just like a 30, where it passes visitors and bots to the new page, but it may not pass along link equity. It is not recommended using 302 redirects for permanent changes.
HTTP Status Code 404 - Not Found This implies the server did not find the file or page that the browser is requesting. 404s don’t show whether the missing resource or pages are missing temporarily or permanently. You can check what this appears to be on your site by writing in a URL that doesn’t exist. Every site will have some pages that display the 404 status codes.
HTTP Status Code 200 - OK This is the ideal status code for a properly functioning page. 
HTTP Status Code 410 - Gone A 410 implies the page is no longer available from the server and they have set no forwarding address. Any links you present on your site that are directed to a 410 page are sending visitors and bots to a dead resource.
HTTP Status Code 500 - Internal Server Error This status code shows a problem with the server and will affect access to your site. Bots and human visitors alike will get lost, and your link equity will go nowhere fast. 
HTTP Status Code 503 - Service Unavailable 503 response, shows that the server is unavailable. This could be because of temporarily overloading the server or maintenance of the server.