1. What is the difference between HTML and HTML5?
HTML5 is the latest version of HTML, introducing new elements and APIs for enhanced web development. It supports multimedia elements, better form controls, and improved APIs for offline web apps.
2. Explain the difference between HTTP and HTTPS.
HTTP (Hypertext Transfer Protocol) is insecure, while HTTPS (Hypertext Transfer Protocol Secure) uses a secure SSL/TLS connection to encrypt data, providing a secure communication channel over the internet.
3. What do you mean by ETag (Entity Tag) and how does it work?
The ETag (entity tag) is a part of the HTTP protocol. This is one of several mechanisms that HTTP provides to validate Web caches, which allows conditional requests to be made from a browser to resources. Moreover, Etags make sure that simultaneous updates of the same resource don't overwrite each other (mid-air collisions).
ETags are opaque identifiers assigned by a server to a specific version of a resource found at a specific URL. Every time the resource representation at that URL changes, an entirely new ETag is assigned. As such, ETags can be compared in the same way as fingerprints and determine if two representations of a resource are identical.
Syntax:
ETag: W/"<etag_value>"
ETag: "<etag_value>"
4. List out newly introduced input types, APIs, form elements, and elements that support media content in HTML5.
List out newly introduced input types, APIs, form elements, and elements that support media content in HTML5.
HTML5 has been updated repeatedly in the last few years, and the addition of input types has greatly simplified its use. Among some of these input types are
- Colour: Enable users to select or choose a colour using the colour picker.
- Date: Enable users to select or choose a date from a drop-down calendar.
- Datetime-local: Enable users to select or choose both local date and time.
- Email: Enable users to enter an email address.
- Month: Enable users to select or choose a month and year from a drop-down calendar.
- Week: Enable users to select or choose week and year from a drop-down calendar.
HTML5 introduces the following new form elements:
- <datalist>: Specifies a list of options for input controls.
- <keygen>: Creates an encryption key.
- <output>: Defines the result or output of an expression.
- <progress>: Heads in the direction of 100% of the maximum value.
- <meter>: Provides a gauge that shows a general value within a range.
The following are some of the new APIs introduced in HTML5:
- History API: Provides programs with access to the browser's history.
- Page visibility API: Enables us to determine the current visibility state of a page.
- Battery Status API: Displays the current battery status of the device.
- User Timing API: Provides programmers with high-precision timestamps for measuring application performance.
- Vibration API: Provides access to the device's vibration functionality.
HTML5 includes five elements that support media as follows:
- <audio>: Used to embed audio files in a web page
- <video>: Used to embed video files in a web page.
- <source>: Used for attaching multimedia files, including audio, video, and photos.
- <embed>: Used to embed external applications, usually multimedia content such as audio or video into an HTML document.
- <track>: Specifies text tracks for audio and video components.
5. What do you know about pair programming?
Pair programming is sometimes referred to as pairing. In pair programming, two programmers work together at one (single) workstation. Those who write code are known as drivers, and those who monitor and navigate each line of code are known as navigators. Both of them may switch roles frequently.
6. While building a web application, how do you consider SEO, maintainability, UX, performance, and security?
Security should be a top priority in any organization that handles vital data. On the other hand, SEO and UX should be prioritized for small and medium-sized online businesses. You will need to pay more attention to performance and SEO if you write an online publication.
7. State difference between SVG (Scalable Vector Graphics) and Canvas.
HTML5 introduced two new graphical elements, Canvas (<canvas>) and SVG (<svg>), that make your web pages more interactive and more graphically attractive. Each has its own properties and can be used to create graphic elements on web pages.
<svg> tag | <canvas> tag |
---|---|
In web pages, SVG is used to define vector-based graphics (vector image format). Unlike raster images (ex. .jpg, .gif, .png, etc. ), vector images can be stretched or compressed without losing quality. | Canvas is a raster-based format composed of pixels. |
SVG provides better scalability, enabling high-quality printing at any resolution. | The canvas is not suitable for printing at high resolutions since it has poor scalability. |
Through scripting and CSS, SVG can be modified. | Modifying a canvas is only possible through the script. |
The performance of SVG is better when dealing with fewer objects (<10k) or larger surfaces. | Canvas performs better when there is a smaller surface area or a larger number of objects (>10k). |
8. What is Type Coercion in JavaScript?
The term type coercion refers to the process of converting values from one data type to another, either automatically or implicitly. For instance, you could convert a number to a string, a string to a number, or a boolean to a number, etc.
Example: Number to String Conversion
<script> // The Number 5 is converted to // string '5' and then '+' // concatenates both strings const value1 = 5; const value2 = '50'; var x = value1 + value2; document.write(x);</script>
Output:
550
The above example shows how JavaScript converted the number 5 into a string and concatenate the values together, resulting in 550.
9. What is the difference between <window.onload> and <onDocumentReady>?
It is true that both the <window.onload> and <onDocumentReady> functions perform tasks when the page has been loaded in the browser, however, the execution of the two functions differs slightly.
- Window.onload: This event is triggered when a web page has fully loaded. In other words, it waits for the DOM and all the associated resources to load, and then executes code. DOM contains all HTML tags, like anchor tag, h1 tag, p tag, etc.
- onDocumentReady: The "onDocumentReady" method, on the other hand, executes the code when the DOM has been loaded. It typically waits for HTML tags, anchor tags, etc., but not for images, videos, or other contents.
10. Describe the different kinds of HTTP requests supported by RESTful Web services.
Each HTTP request type in RESTful web services has a specific purpose. Below is a description of them:
- GET: It is used to retrieve data or resources from the server but only allows read-only access. You cannot modify it.
- POST: It is used for creating a new resource.
- PUT: This is similar to POST, but used for updating an existing resource (if the resource doesn't exist, the API will decide whether a new resource should be created).
- DELETE: It is used to delete the resource from the server.
- TRACE: It validates the content along with the network during an HTTP request.
11. What is the best way to integrate different stylesheets into a website?
Typically, it depends on how your site is laid out and how users interact with it. The most efficient way, however, would be to use just a single file called styles.css (or something similar). Combining them into a single document is preferable. Loading one file is easier for a client than loading five. In order to change the style, you simply open the styles.css file, scroll down to find the appropriate section, and modify the CSS. The sheet can be linked in your HTML as follows:
<link rel="stylesheet" href="/blog/styles.css">
12. How do you optimize the loading time of your web application as a Web Developer?
As a Web Developer, here are the top hacks for reducing load time and optimizing your web application's loading times:
- Image compression and optimization: Using images on your website will improve the appearance and quality of your pages. However, larger images will also slow down the loading process. Compressing and optimizing images is one of the easiest ways to improve the speed of your site. The smaller your images' file sizes, the less weight they have, which, in turn, helps your pages load faster.
- Put JavaScript and CSS in external files: When JavaScript and CSS are embedded in HTML documents, they are downloaded each time the HTML document is loaded. As a result, this does not utilize browser caching, increasing the size of HTML documents. You should always place CSS and JavaScript in external files; this is best practice and makes maintaining your site easier.
- Reduce the number of redirects: A website with too many redirects will take a long time to load. HTTP request and response times are prolonged every time a page redirects. If you eliminate unnecessary redirects on your site, your page load time will be significantly reduced.
- CSS and JavaScript files should be loaded asynchronously: You have CSS and JavaScript files on your website that can be loaded synchronously or asynchronously. In synchronous loading, each file is loaded one at a time, in the order in which it appears on your web page. Asynchronous loading, on the other hand, allows multiple files to be loaded simultaneously, which can speed up the performance of a website. '
- Minify HTML, CSS, and JavaScript: Your pages will load faster if you optimize how your files to load. In a similar vein, you can minify your HTML, CSS, and JavaScript code. You can reduce the size of files by eliminating unnecessary spaces, characters, comments, and other components. As a result, web pages will load faster with cleaner code.
13. What are different popup boxes that are available in JavaScript?
Javascript uses pop-up boxes to display notifications and messages to users. Here are the different types of pop-up boxes in Javascript:
- Alert Box: This is used to display a warning message. After the alert box appears, the user needs to press the OK button to proceed.
Syntax:
alert("Your Alert Text")
Example: Running the following script will open an alert box that contains the message: "This is Scaler Academy" along with a confirmation button OK.
<script> alert("This is Scaler Academy");</script>
- Confirm Box: These pop-up boxes are used as a means of obtaining authorization or permission from the user. In order to proceed, the user must click the OK or Cancel button.
Syntax:
confirm("Your query")
Example: Upon executing the following script, it will open a confirmation box containing the following text: "Confirm this action" along with a confirmation button and cancellation button. Based on the input provided by the user, this returns a boolean. It will return true if the user clicks to confirm, and false if the user clicks cancel.
<script> let bool = confirm("Confirm this action"); console.log(bool);</script>
- Prompt Box: The purpose of this type of pop-up box is to gather user input for further use. After entering the necessary information, the user has to click OK to proceed to the next stage, otherwise pressing the Cancel button returns the null value.
Syntax:
prompt("Your Prompt")
Example: Running the following script will open a pop-up box with the message: "Enter your email". There will also be a confirmation button and a cancellation button.
<script> let name = prompt("Enter your email"); console.log(name);</script>
You'll be able to see your email on the console once you enter some input in the prompt box.
14. Explain the term “Scope” in JavaScript and write its different type.
Managing the availability of variables or objects in an application is governed by the concept of scope. In JavaScript, there are two types of scope as follows:
Global Scope: A variable having global scope can be accessed from anywhere in the program. These variables that are declared outside of any function can be accessed from any place in the program.
Example:
let scalerProgram = "DataScience"// code here can use scalerProgramfunction myScaler() {// code here can also use scalerProgram}
Local Scope: Variables with a local scope can only be accessed within the same function in which they are declared. Whenever a variable is declared inside a function, it becomes local to the function. As soon as a function begins, local variables are created and deleted when the function is executed.
Example:
// code here can NOT use scalerProgramfunction myScaler() { let scalerProgram = "DataScience"; // code here CAN use scalerProgram}// code here can NOT use scalerProgram
15. What are pseudo-classes?
A pseudo-class is basically used to define or specify a special state of an HTML element. This can be used in conjunction with an existing CSS selector to add effects to elements based on their state. For instance, changing the style of an element when a user hovers over it or using different styles for visited and unvisited links. The pseudo-class gives you the ability to do all of this.
Syntax:
selector: pseudo-class{ property: value;}
In CSS, there are many pseudo-classes, but the ones that are most frequently used are as follows:
- :visited pseudo-class: Select the links that the user has already visited.
- :hover pseudo-class: A special effect can be added to an element when the mouse pointer is over it.
- :active pseudo-class: Select the element that becomes active when the user clicks on it.
- :focus pseudo-class: Select an element that is currently focused by the user.
16. Why are media queries used in CSS?
Media queries are used in CSS to create responsive web designs. This means that the way a web page appears varies from one system to another based on the screen or the media type. The media query can be used to apply different styles or change the appearance (and even the behaviour) of a site or an app depending on a user's device type or specific characteristics (like browser viewport width, height, screen resolution, etc.). The following can be checked using media queries:
- Dimensions (width and height) of the viewport
- Dimensions (width and height) of the device
- Orientation
- Resolution
17. What is the purpose of closures in JavaScript?
In JavaScript, a closure is known as a JavaScript closure or JS closure. Closures allow you to access the scope (variables and parameters) of an outer function from an inner function. Every time a JavaScript function is created, a closure is created. JavaScript closures allow you to control which variables are and are not in scope in a given function, as well as which variables are shared among siblings within the same containing scope.
18. What does a web developer do?
Typically, there are three types of web developer jobs based on skills: front-end, back-end, and full-stack development. Front-end web developers design the look of a website (visible to users) and focus on visual elements of the website. A backend developer is responsible for server-side (non-visible to users) application logic and front-end integration. Full Stack Developers work both on the Back End (server-side) and Front End (client-side) of an application.
19. How much time does it take to learn web development?
For a beginner, learning web development from the ground up would take you about four to six months if you study 2-3 hours every day. Some people learn within a couple of months, while others take a year or so.
20. What should a web developer know?
Web Developers must have a good understanding of HTML, CSS, and JavaScript. Additionally, you should learn about libraries and frameworks such as Bootstrap and jQuery. Having these foundational skills will help you understand how programming languages work.
21. Do web developers use coding?
For creating websites and web applications, web developers use programming languages (such as JavaScript, and Python). A developer turns the plans and visions of web designers into what you see on your phone, tablet, or computer screen by using code.
22. What is the average salary of a web developer in India?
It is estimated that web developers with 1-4 years of experience can earn around Rs 3,04,000 per annum. With 5-9 years of experience, you can expect to make around Rs 5,89,000 per year. Over ten years of experience in this field can earn you around Rs 1,000,000 annually. However, the range of the salary depends on a variety of factors such as your experience, employer (company profile), skills, and location.
23. Why should you be hired for a web development internship?
As people embark on further education and prepare to enter some well-reputed organization, this is likely to be one of the most common questions they encounter.
Sample "As a fresher, I am interested in starting my career with a company like yours. I am well versed in all the required subjects. Even though I am a newbie, I am a very quick learner, and I am also highly trainable. By having these two skills, I am able to learn new techniques and skills very fast, and I also adjust to new environments more quickly. I have a few fresh ideas that may help your company grow and thrive. Furthermore, I would like to learn from professionals working with your team and refine my skills".
24. State the difference between a web developer and a software developer?
The main difference between web developers and software developers pertains to the types of projects they may work on. The role of a web developer is to develop web-based applications such as websites, e-commerce, and mobile applications. As a software developer, you will focus on developing software for underlying operating systems, networks, or platforms. Software developers can be involved in the service development of web applications, etc.
25. How do you talk about web-development project in an interview?
Make sure you categorize your project into several steps and explain them in a very clear manner in order to win an interview. Here are some steps to explain a project:
- Project Introduction
- Modules description
- Benefits and main features of your application
- The tools, technologies, and platforms that were used
- Contribution and your involvement in the project
- The challenges you faced in the project and how you overcame them
- Future improvements to the current system
26. What are different types of web development?
Different web development types include:
- Front-end: Front-end developers design the look of a website (visible to users) and focus on visual elements of the website.
- Back-end: A backend developer is responsible for server-side (non-visible to users) application logic and front-end integration.
- Full Stack: Full Stack Developers work both on the Back End (server-side) and Front End (client-side) of an application.
- UI (User Interface) developers: UI developers are responsible for designing and developing a website's User Interface. They design the look, feel, and presentation of web applications, as well as ensure their functionality.
27. Code Snippet: Basic HTML Structure
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>My Web Page</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>