HTML Web Laboratory: Viva Questions
Part I: Viva Voce Questions
1. Basic HTML Concepts
- What is HTML? Explain its full form and purpose.
- What is the latest version of HTML? Name two important new features introduced in it.
- What is a markup language? How is HTML different from a programming language?
- What is the basic structure of an HTML document? Write the minimal HTML5 page.
- What is the purpose of the
<!DOCTYPE html> declaration?
2. HTML Tags and Elements
- What are HTML tags? Give the syntax of a typical HTML tag.
- Differentiate between block-level and inline elements. Give two examples of each.
- What is the difference between a container tag and an empty (void) tag? Give examples.
- How many heading levels are there in HTML? Which one is the most important?
- What is the purpose of the
<p> tag? How is it different from <br>?
3. Document Structure
- What is the role of the
<head> tag in an HTML document?
- What is the purpose of the
<title> tag? Where is it displayed?
- What is the
<body> tag used for? What kind of content goes inside it?
- What is the
<meta> tag? Give one use of it (e.g., charset or description).
- What is the
<style> tag used for? Where is it usually placed?
4. Text Formatting and Lists
- Name HTML tags used to make text bold, italic, and underlined.
- What is the difference between
<b> and <strong>?
- What are the different types of lists in HTML? Give their tags.
- How do you create an ordered list? How do you change its starting number?
- How do you create an unordered list with custom bullet style (e.g., disc, circle, square)?
5. Links and Images
- What is the
<a> tag used for? What is the purpose of the href attribute?
- How do you make a hyperlink open in a new tab/window?
- How do you create an email link using the
<a> tag?
- How do you insert an image in HTML? What are the required attributes of the
<img> tag?
- Why is the
alt attribute important in the <img> tag?
6. Tables
- Which tags are used to create a table in HTML?
- What is the difference between
<th> and <td>?
- How do you merge cells in a table? Explain
rowspan and colspan with an example.
- What is the difference between
cellspacing and cellpadding?
- How do you give a border to an HTML table?
7. Forms
- What is the purpose of the
<form> tag? Name its important attributes.
- What is the difference between
method="get" and method="post" in a form?
- Name different input types used in HTML forms (e.g., text, password, checkbox, etc.).
- What is the purpose of the
<label> tag in a form?
- How do you create a dropdown list in HTML? Which tags are used?
8. HTML5 and Advanced Tags
- What are semantic elements in HTML5? Give three examples.
- How does HTML5 support audio and video? Name the relevant tags.
- What is the purpose of the
<div> and <span> tags? How are they different?
- What is the
<marquee> tag? Is it recommended in modern HTML? Why?
- How can you set a background image for a web page using HTML?
9. Practical / Lab-Based Questions
- Write HTML code to create a simple web page with a heading, a paragraph, and a link.
- Write HTML code to create a table with 3 rows and 3 columns.
- Write HTML code to create a form with name, email, and submit button.
- How do you add comments in HTML? Give the syntax.
- What are the common mistakes students make while writing HTML code in the lab?
Part II: Quick Reference & Sample Answers
Q1: What is HTML?
HTML stands for HyperText Markup Language. It is a markup language used to create web pages by using a set of tags and attributes to structure and format content. HTML provides the structure and semantic meaning to web content.
Q4: Minimal HTML5 Page Structure
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Title</title>
</head>
<body>
<h1>Hello World</h1>
<p>This is a paragraph.</p>
</body>
</html>
Q7: Block vs Inline Elements
- Block-level elements: Start on a new line and take up the full width available (e.g.,
<div>, <p>, <h1>-<h6>, <ul>, <li>).
- Inline elements: Do not start on a new line and only take up as much width as necessary (e.g.,
<span>, <a>, <strong>, <em>, <img>).
Q17: <b> vs <strong>
<b>: A presentation element. It makes text bold visually but implies no extra importance.
<strong>: A semantic element. It indicates strong importance; it makes text bold visually and alerts screen readers to emphasize the text verbally.
Q26: Table Tags
<table>: Container for the table.
<tr>: Table row.
<td>: Table data (standard cell).
<th>: Table header (bold and centered cell).
<thead>, <tbody>, <tfoot>: Used for grouping table sections.
Q31: Form Tag Overview
The <form> tag creates an HTML form for user input.
Important attributes:
action: Specifies the URL where the form data is sent.
method: Specifies the HTTP method (GET or POST).
name: Specifies the name of the form.
Q42: Practical Example - Table
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
<td>Data 3</td>
</tr>
</table>
Q43: Practical Example - Form
<form action="/submit" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<button type="submit">Submit</button>
</form>
Q44: HTML Comments Syntax
Comments are not displayed in the browser but help developers understand the code.
<!-- This is a single-line comment -->
<!--
This is a
multi-line comment
-->