HTML
Q.1 <!DOCTYPE html> Is it a tag of HTML? If not, what is it and why do we use it? (1 Mark)
<!DOCTYPE html>
is not a tag of HTML. It is simply a document type declaration (DDT)
that is used to specify the version and type of the HTML document.
Q.2 Explain Semantic tags in HTML. And why do we need it? ( 2 Marks)
Semantic
tags are the tag in HTML that describes their role to both the developer and browser. Eg. nav, section main, footer.
The main reason we need it is because it provides clarity in understanding and also has future compatibility.
Q.3 Differentiate between HTML Tags and Elements? (2 Marks)
HTML tags
are used to define the start and end of an element whereas an HTML element
is the entire thing from start to end tag.
Q.4 What are some of the advantages of HTML5 over its previous versions? (2 Mark)
It provides built-in support for audio and video.
It includes support for svg.
It provides API for geolocation and device access of user.
It provides form Enhancement like email date placeholder, required, etc.
Q.5 What is the difference between <figure> tag and <img> tag? (1 Mark)
Image
tag simply responsible for the image whereas figure
tag makes difference in the alignment of the image & caption.
Q.6 What’s the difference between html tag and attribute and give examples of some global attributes? (2 Marks)
HTML
tag defines the structure and semantic meaning of the content in HTML.
Eg. <p> <div> <img>
Whereas attribute
provides information or modifies the behavior of HTML tag
Eg. id, class, src, href, style, alt.
Q7. Explain the difference between block-level and inline elements.
Block-level elements start on a new line and take up the full width available. They can contain other block-level and inline elements. Examples include
<div>
,<p>
, and<h1>
.Inline elements, on the other hand, do not start on a new line and only take up as much width as necessary. They can only contain other inline elements or text. Examples include
<span>
,<a>
, and<strong>
.
Q8. How can you link an external CSS stylesheet to an HTML document?
- You can use the
<link>
element within the<head>
section and set therel
attribute to "stylesheet". Thehref
attribute should point to the URL of the CSS file.
Q9. What is the purpose of the <div>
element?
- The
<div>
element is a generic container that is used to group and style content together. It does not have any inherent semantic meaning and is often used for layout purposes.
Q10. What is the purpose of the HTML form
element?
The form
element is used to create an interactive area that collects and submits user input, such as text fields, checkboxes, radio buttons, and buttons. It's often used for user authentication, contact forms, search boxes, etc.
Remember, these questions cover a range of HTML concepts from basic structure to elements and their usage. Depending on the depth of knowledge you're looking for, you can adjust the complexity of your questions.
Practice
Certainly, here's a more detailed project scenario that can help assess a fresher's HTML skills and also boost their confidence during an interview: