Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
10 views

HTML Interview Question SEVE

The document explains various HTML tags and their usage. It contains questions and answers related to basic HTML tags like headings, paragraphs, lists, tables, forms, and links. It provides details on HTML structure, attributes of different tags and how to create hyperlinks for text and images.

Uploaded by

Gayatri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

HTML Interview Question SEVE

The document explains various HTML tags and their usage. It contains questions and answers related to basic HTML tags like headings, paragraphs, lists, tables, forms, and links. It provides details on HTML structure, attributes of different tags and how to create hyperlinks for text and images.

Uploaded by

Gayatri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

1. What is the full form of html?

Ans: Full form of HTML is HyperText Markup Languauge.

2. What is an html file?


Ans: HTML files are text-only documents that can contain highly interactive content and
Are designed specifically for digital viewing. The file extention .html or .xml is called
html file.

3. What is the role of markup tags?


Ans: A markup tag is a directive that contains snippet of code with a relative reference to
an object in your store such as a variable, URL , image ,or block. Markup tags can be
used anywhere the editor is available and incorporated into the HTML of email and
newsletter templates , as well as other types of content.

4. Which extension html file needs?


Ans: The two most used extensions of HTML documents are .html and .htm.

5. Html tags are case sensitive or not?


Ans: HTML tags are not case sensitive,:<P> means the same as <p>,during parsing, all
html elements are converted to lowercase first.

6.What are the tags in html?


Ans: HTML tags are composed of three things: opening tag, content and ending tag.
Some tags are unclosed tags.
HTML documents contain two things:
1. content
2. tags
When web browser reads an HTML document, the browser reads it from top to bottom
And left to right. HTML tags are used to create HTML documents and render their
properties. Each HTML tags are have different properties.
<tag>content</tag>
Content is placed between tags to display data on the web page.
7. Why are tags used in html?
Ans: “Tags” provides web browsers with instructions about the web page, such as where to
display images, and how the document is structured. Tags are always enclosed in angle
brackets:< >. Tags are comprised of elements and attributes.
8. Write the basic structure of an html program?
Ans:
<!DoctypeHtml>
<head>
<title>DocumentTitle</title>
</head>
<body>
<p>This is paragraph tag in HTML document.</p>
</body>
9. Tell some html basic tags?
Ans: Basic HTML tags:

10. Define attribute in html?


Ans: HTML attributes are special words used inside the opening tag to control the elements
behaviour. HTML attributes are a modifier of a HTML element type. An attribute either
modifies the default functionality of an element type or provides functionality to certain
element types unable to function correctly without them.
11. Is the attribute always comes in pairs if yes then why or if not then why?
Ans: They always come in pairs (atribute_name=“value”). The attribute's names are case-
insensitive. attributes comes in pair because attributes provides additional information about
elements. Attributes usually come in name/value pair like name=”value”.
12. Are attributes added in start tags or end tags?
Ans: Attributes are always specified in the start tag. Because HTML attributes provide
additional information about HTML elements. They are used to modify the behaviour or
appearance of an element.
13. Explain the heading tags in html?
Ans: heading tags, are used to separate headings and subheadings on a webpage. They rank
in order of importance, from H1 to H6,
14. Explain paragraph tags in html?
Ans: HTML paragraph or HTML p tag is used to define a paragraph in a webpage. Browser
itself add an empty line before and after a paragraph. An HTML <p> tag indicates staring of
new paragraph. If we put a lot of spaces inside the HTML p tag, browser removes extra
spaces and extra line while displaying the page. The browser counts number of spaces and
lines as a single one.
15. Which tag is used to break the line in html?
Ans: <br> tag is used to break the line in html.
16. Is <br> an empty tag?
Ans: The <br> tag is an empty tag, i.e. there is no need to close this tag
17. What is a comment in html?
Ans: The comment tag is used to insert comments in the source code. comments are not
displayed in the browsers. we can use comments to explain your code, which can help you
when you edit the source code at a later date. comments are useful if you have a lot of code.
In html comments are defined in <!---->tag.
18. What are the attributes of a body tag?
Ans: The body tag can also include attributes, such as the background color, text color, and
link color. The body tag can also include other HTML elements, such as headings,
paragraphs, lists, images, and tables.
19. What are the attributes of font tag?
Ans: The font tag in HTML has three attributes, namely: size, color, and face
20. What are the text formatting tags?
Ans: Bold text: <b> or <strong>, Italicized text: <i> or <em>, Underlined text: <u>, Strike-
through text: <del> or <s>, Superscript and subscript text: <sup> or <sub>
21. What is table tag and explain in detail?
Ans: The <table> tag defines an HTML table. An HTML table consist of one <table>
element and one or more <tr>,<th> and <td> elemets. The <tr> element defines a table row,
the <th> element defines a table header, and the <td> elemet defines a table cell.

22. What are the attributes of table tags?


Ans: Align – it indicates how table will be aligned in the document. Bgcolor- set the
background colour of the table. Cellpadding – this is used to control the distance between the
data in a cell and boundaries of the cell.
23. What is an image tag and explain its attributes?
Ans: The img elemet is used to insert images into an HTML document. It is an empty tag.
The img element has two required attributes:1) src: The source location (URL) of the image
file. 2) alt: The alternate text. This is used to describe the image for someone who cannot see
it because they are either using a screen reader or the image src is missing.
24. What is anchor tag and explain attributes of anchor tag?
Ans: The HTML anchor tag defines a hyperlink that links one page to another page. It can
create hyperlink to other web page as well as files, location or any URL.
Attributes:
1. “href” attribute is the most important attribute of anchor tag, it is used to define the
address of the file to be linked.
2. “target” attribute can only use with href attribute in anchor tag. If we will not use target
attribute then link will open in same page. It have two values “self” and “blank”.
href, name, target, title
25. How to create simple text as hyperlink?
Ans: code used to create a hyperlink is the "anchor" tag, or "a" tag.
26. How to create an image as a hyperlink?
Ans: If we want to make the image as a link for linking another html page and the we have to
follw the steps which are given below.
Step1: take anchor tag , inside href arrtribute give the link and in between the opening and
closing anchor tag put the img tag and give the path to the src attribute, to create a image as a
hyperlink. Example:
<a href="link"> <img src="1.jpg" alt=""></a>
27. How to create an email as a hyperlink?
Ans:

28. What are the list tags in html?


Ans: HTML description list tags are:
1. <d1> tag: dl tag defines the start of the list.
2. <dt> tag: dt tag defines a term.
3. <dd> tag: dd tag defines a term definition or description.

HTML ordered list tags are:


1. <ol> tag: ol tag defines the ordered list.
2. <li> tag: li tag defines the each list item.

HTML unorederd list tags are:


1. <ul> tag:ul tag defines the unordered lis.
2. <li> tag: li tag defines the each list item.
29. Write the attributes of order list and unordered list? <li value = number>, <ol type =
“1|b|A|i|I”>, <ul style=”list-style-type:square|disc|none;”>
30. What is a form in html?
Ans: HTML form on a web page allows a user to enter data that is sent to a server for
processing. The <form> element is a container for different types of input elements.such as
text fields, checkboxes, radio buttons, submit buttons etc.
There are two methods of form: get and post method.
1. get method: get method is used to request data from a specified resource.
2. Post method: post method used to send data to a server to update a resource.
3. Action attribute: It specifies where to send the form data, when a form is submitted.
31. What are form elements?
Ans: Elements of form :
<form>: It defines an HTML form to enter inputs by the used side.
<input>: It defines an input control.
<textarea>: It defines a multi-line input control.
<label>: It defines a label for an input element.
<fieldset>: It groups the related element in a form.
<legend>: It defines a caption for a <feildset> element.
<select>: It defies a drop-down list.
<optgroup>: It defines a group of related options in a drop-down list.
<option>: It defines an option in a drop-down list.
<button>: It defines a clickable button.
32. What are the attributes of form tag?

33. What is the role of the target attribute of form tag?


Ans: The target attribute specifies a name or a keyword that indicates where to display the
response that is received after submitting the form. The target attribute defines a name of, or
keyword for, a browsing context (e.g. tab, window, or inline frame).
34. What are the attributes of the input tag in html?
Ans: Value, readonly, disabled, size, maxlength, min and max, multiple, pattern, placeholder,
required, autofocus, height and width, list, autocomplete,
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
<input type="text" id="fname" name="fname" value="John" readonly><br>
<input type="text" id="fname" name="fname" value="John" disabled><br>
<input type="text" id="fname" name="fname" size="50"><br>
<input type="text" id="pin" name="pin" maxlength="4" size="4">
<form>
<label for="datemax">Enter a date before 1980-01-01:</label>
<input type="date" id="datemax" name="datemax" max="1979-12-31"><br><br>
<label for="datemin">Enter a date after 2000-01-01:</label>
<input type="date" id="datemin" name="datemin" min="2000-01-02"><br><br>
<label for="quantity">Quantity (between 1 and 5):</label>
<input type="number" id="quantity" name="quantity" min="1" max="5">
</form>
input type="file" id="files" name="files" multiple> => The input multiple attribute specifies
that the user is allowed to enter more than one value in an input field.
<form action="/action_page.php">
<label for="files">Select files:</label>
<input type="file" id="files" name="files" multiple><br><br>
<input type="submit" value="Submit">
</form>
<form action="/action_page.php">
<label for="country_code">Country code:</label>
<input type="text" id="country_code" name="country_code" pattern="[A-Za-z]{3}"
title="Three letter country code"><br><br>
<input type="submit" value="Submit">
</form>
<form action="/action_page.php">
<label for="phone">Enter a phone number:</label>
<input type="tel" id="phone" name="phone" placeholder="123-45-678" pattern="[0-9]{3}-
[0-9]{2}-[0-9]{3}"><br><br>
<input type="submit" value="Submit">
</form>
<form action="/action_page.php">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<input type="submit" value="Submit">
</form>
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" autofocus><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
</form>
<form action="/action_page.php">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="image" src="img_submit.gif" alt="Submit" width="48" height="48">
</form>
<form action="/action_page.php">
<input list="browsers" name="browser">
<datalist id="browsers">
<option value="Edge">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
<input type="submit" value="Submit">
</form>
<form action="/action_page.php" autocomplete="on">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" autocomplete="off"><br><br>
<input type="submit" value="Submit">
</form>
35. What is the textarea tag and explain its attributes?
Ans: The <textarea> element is often used in a form, to collect user inputs like comments or
reviews. The size of a text area is specified by the cols and rows attributes. autofocus, cols,
dir, disabled, form, maxlength, name, placeholder, readonly, required, rows, wrap
36. What is the select tag and explain its attributes?
Ans: The <select> element is used to create a drop-down list. autofocus, disabled, form,
multiple, name, required, select, size
<label for="cars">Choose a car:</label>
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
37. What is an option tag and explain its attributes?
Ans: The <option> tag defines an option in a select list. disabled, label, selected, value
<select id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
38. Explain inline frame in detail and its attributes?
Ans: Inline frame (iframe) is a HTML element that loads another HTML page within the
document. allow, allowfullscreen, allowpaymentrequest, height, loading, name,
referrerpolicy, sandbox, src, srcdoc, width
<iframe src="https://www.w3schools.com" title="W3Schools Free Online Web Tutorials">
</iframe>
39. What is canvas tag and explain its attributes?
Ans: The HTML canvas element provides HTML a bitmapped surface to work with. It is
used to draw graphics on the web page.
The HTML5 <canvas> tag is used to draw graphics using scripting language like JavaScript.
If we want to draw a staright line on the canvas, there are 2 methods :
1. moveTo(x,y) : It is used to define the starting point of the line.
2. lineTo(x.y) : It is used to define the ending point of the line.
The <canvas> tag is used to draw graphics, on the fly, via scripting. height, width

40. What is svg?


Ans: SVG stands for Scalable Vector Graphics. SVG is used to define vector-based graphics
for the Web.
41. Explain the audio tag in detail?
Ans: The <audio> tag is used to embed sound content in a document, such as music or other
audio streams. autoplay, controls, loop, muted, preload, src
<audio controls>
<source src="horse.mp3" type="audio/mpeg">
</audio>
42. Explain the video tag in detail?
Ans: The <video> tag is used to embed video content in a document, such as a movie clip or
other video streams. autoplay, controls, heigh, loop, muted, poster, preload, src, width
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
</video>
43. Explain the difference between div and span tags?
Ans: A div element is used for block-level organization and styling of page elements,
whereas a span element is used for inline organization and styling.
44. What is the use of marquee tags in html?
Ans: The <marquee> tag in HTML is used to create scrolling text or images on a webpage.
bgcolor, direction Top, Down, Left, Right, loop Number, height px or %, width px or %,
hspace px, vspace
<!DOCTYPE html>
<html>
<head>
<title>Marquee Tag</title>
<style>
.main {
text-align: center;
}

.marq {
padding-top: 30px;
padding-bottom: 30px;
}

.geek1 {
font-size: 36px;
font-weight: bold;
color: white;
padding-bottom: 10px;
}
</style>
</head>

<body>
<div class="main">
<marquee class="marq" bgcolor="Green"
direction="left" loop="">
<div class="geek1">
GeeksforGeeks
</div>
<div class="geek2">
A computer science portal for geeks
</div>
</marquee>
</div>
</body>

</html>
45. Do all the html tags have end tags?
Ans: Most of the HTML tags have a start tag and an end tag. some of the HTML tags doesn't
require for end tag or closed symbol("/").
46. What are the semantic elements?
Ans: Semantic HTML elements are those that clearly describe their meaning in a human- and
machine-readable way. Elements such as <header> , <footer> and <article>
47. What is the difference between block level elements and inline elements?
Ans: Block elements always start from a new line. Inline elements never start from a new
line. Block elements cover space from left to right as far as it can go. Inline elements only
cover the space as bounded by the tags in the HTML element.
48. Give the example of block level elements and inline elements?

49. What are the void elements in html?


Ans: A void element is an element whose content model never allows it to have contents
under any circumstances. A void element is an element in HTML that cannot have any child
nodes (i.e., nested elements or text nodes). Void elements only have a start tag; end tags must
not be specified for void elements. Void elements can have attributes. The following is a
complete list of the void elements in HTML : area , base , br , col , command , embed , hr ,
img , input , keygen , link , meta , param , source , track , wbr.
50. How to optimize website assets loading?
Ans: Optimizing your website means improving its performances across various areas,
including traffic, conversion rates, and usability.
Prefetching should be enabled, Provide fast loading times, Scripts should be placed at the
bottom and style sheets at the top, Reduce HTTP requests, Utilize a CDN service Files
should be compressed.
51. What are the different types of doctypes available?
Ans: HTML5 doctype, Strict doctype (HTML 4.01), Transitional doctype (HTML 4.01)
52. What is the difference between <strong>, <b> and <em>, <i> tags in html?
Ans: General consensus is that 'em' and 'strong' should be used as they indicate semantic
meaning as well as how the text should look whereas 'b'and 'i' only do the latter.
53. What is the significance of <head> and <body> tags in html?
Ans: Things in the head tag are things that shouldn't be rendered: information about the page
and how to process it. Things in the body tag are the things that should be displayed: the
actual content.
54. Can we display a web page inside a web page or is nesting of webpage possible?
Ans: Yes, we can display a web page inside another HTML web page.
55. How is cell padding different from cell spacing?
Ans: Cell spacing refers to the distance between the cells in a grid layout, and cell padding
refers to the space around each cell.
56. How can we club two or more rows or columns into a single row or column in a html
table? To merge two or more row cells, use the rowspan attribute. If you want to combine the
first two cells in the first column, you can use the colspan="2" attribute in the first tag.
57. Is it possible to change an inline element into a block level element?
Ans: inline elements to behave like block-level elements using the display property.
58. How to include the javascript code in html?
Ans: by using script tag <script src=”” ></script>
59. What type of audio files can be played using HTML5?
Ans: There are three supported audio formats in HTML: MP3, WAV, and OGG.
60. Is drag and drop possible using html5 and how?
Ans: The drag and drop functionality in HTML5 is now consistent and compatible across
browsers. The drag and drop attribute must be set to true and added to each element that
needs to be draggable. The dragstart and dragend events can be used to change the style of
the element being dragged.
61. What is the difference between <meter> and <progress> tag?
Ans: The <meter> tag defines a scalar measurement within a known range or a fractional
value. This is also known as a gauge. The <progress> tag is used to show the completion
progress of a task.
62. Define image map?
Ans: With HTML image maps, you can create clickable areas on an image.
<img src="workplace.jpg" alt="Workplace" usemap="#workmap" width="400"
height="379">

<map name="workmap">
<area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm">
<area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
<area shape="circle" coords="337,300,44" alt="Cup of coffee" href="coffee.htm">
</map>
63. Is the <datalist> and <select> tag same?
Ans: <datalist> and <select> tags generally are used for choosing an option from the given
list. But the main difference between both is that in the <datalist> tag the user can enter their
input and add that as an option with the help of the <input> element whereas the <select> tag
doesn’t provide this feature.
<datalist id="courses">
<option value="DSA">
<option value="ML and AI">
</datalist>
<select id="courses">
<option value="Java">Java</option>
<option value="C++">C++</option>
</select>
64. What is the difference between <figure> and <img> tag ?
Ans: The figure tag is used to semantically organize the content of images, videos, audios or
even charts or tables, block of codes in the HTML document. The image tag is used to add
an image to an HTML page. <img> tag can only insert image.
<figure>
<img src="url">
<figcaption>content</figcaption>
</figure>
<img src="url" alt="some_text">
65. Create a nested list in html?
Ans:
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
66. Explain the difference between html and html5?
Ans: HTML5 provides native audio and video support. HTML only supports vector graphics
if used in conjunction with different technologies like Flash, VML, or Silverlight. HTML5
supports SVG (Scalable Vector Graphics), Canvas, and other virtual vector graphics. HTML
allows inline MathML and SVG in text with restricted use.
67. How can you add the css style in an html document?
Ans: CSS is added to HTML pages to format the document according to information in the
style sheet. There are three ways to insert CSS in HTML documents.
1. Inline CSS: Inline CSS Style are included within the HTML document and are specific
or Individual HTML elements are style.
2. Internal CSS: Internal CSS styles are included within the head section of an html
document and apply to the entire document , allowing for constituent styling across
multiple elements.
3. Extenal CSS: External CSS which has least priority and external css file is used to
style one or more multiple web pages.
68. What is the purpose of the required attribute in the <input> tag?
Ans: The HTML Required attribute is a Boolean attribute which specifies that the input
element must be filled out before the submission of form.This attribute used with the
following elements.
1. <input>
We can easily use the required attribute with the <input> element.
Ex: <input required>

You might also like