Welcome to the Master HTML Questions & Answers Guide curated specifically for BCA, MCA, B.Sc. Computer Science students preparing for university theory and viva examinations, as well as aspiring front-end developers preparing for technical coding interviews. This master collection is structured into five core topic categories covering fundamental syntax, semantics, multimedia, modern HTML5 web standards, form validation, and SEO best practices.
if/else), data structures, and algorithmic execution.<!DOCTYPE html> declaration is an instruction to the web browser informing it that the document is written in modern HTML5. It is not an HTML tag and has no closing tag.
<!DOCTYPE html> forces the browser into Standards Mode.
<p> is the opening tag, </p> is the closing tag).<p class="note">Hello World</p>).class="note" or src="logo.png")./>) are completely optional.
<img>, <br>, <hr>, <input>, <meta>, <link>, <source>, <area>, <base>, <col>, <embed>, <param>, <track>, and <wbr>.
<b> is purely stylistic (physical bold) with zero semantic importance. <strong> conveys serious urgent semantic importance; screen readers announce strong text with louder, emphatic vocal inflection.<i> represents alternate voice or technical terms (physical italics). <em> indicates verbal stress emphasis that fundamentally alters the sentence's spoken meaning.<div>, <p>, <h1>, <ul>): Always starts on a new line and stretches horizontally to fill 100% of the available container width. Honors top/bottom margins and height/width properties.<span>, <a>, <strong>): Flows smoothly within text without forcing a line break. Width and height are governed strictly by its contents, and top/bottom margins are ignored.target="_blank" to open a new tab, the newly opened page gains access to the originating page via the JavaScript window.opener object. A malicious external site can exploit this Reverse Tabnabbing vulnerability by executing window.opener.location = "fake-phishing-login.com" behind the user's back.
rel="noopener noreferrer" sets window.opener to null, isolating the new tab and suppressing the HTTP Referer header to protect user privacy.
<, >, &, and " are syntactically reserved by the HTML parser to define tags and attributes. If typed directly into text, the browser mistakes them for markup syntax or breaks the parser. HTML Character Entities (such as < for < and & for &) instruct the browser to render the literal symbol on-screen, preventing syntax errors and Cross-Site Scripting (XSS) injection.
https://veewom.com/html/index.htm), pointing to an exact resource anywhere on the Internet. A Relative URL specifies a path relative to the current file or site root (e.g., ../css/style.css or /images/logo.png). Relative links ensure website portability across local development (localhost), staging, and production domains without editing file paths.
<caption>: Accessible title describing the table's contents.<thead>: Header section containing <tr> and <th> cells. Header cells must use scope="col" or scope="row" to associate headers with data cells for screen readers.<tbody>: Main data rows containing <td> data cells.<tfoot>: Summary/totals row at the bottom of the table.colspan="N": Merges a single table cell horizontally across N adjacent columns.rowspan="N": Merges a single table cell vertically across N adjacent rows down the table.alt (Alternative Text) attribute serves three crucial purposes:
<picture> element is a responsive container that wraps multiple <source> tags and a fallback <img> tag. It enables two major web performance optimizations:
type="image/webp".media="(max-width: 768px)") to serve tightly cropped vertical images to mobile phones and wide banner landscapes to desktop monitors.GET appends data visibly to the URL query string; POST packages data in the HTTP request body.GET exposes passwords and tokens in history, logs, and bookmarks. POST keeps payloads hidden and encrypted under HTTPS.GET is limited to ~2,048 characters. POST supports large multi-megabyte payloads.GET cannot upload binary files. POST supports files via multipart/form-data.GET is idempotent (safe to repeat). POST modifies server state.disabled: The input field is grayed out, cannot receive keyboard focus, cannot be edited, and its value is not submitted in the form payload.readonly: The input field is readable, can be selected, focused, and copied, but cannot be typed into. Its value is submitted in the form payload.pattern attribute defines a JavaScript Regular Expression that the input value must satisfy before the browser permits form submission. For example, pattern="[0-9]{10}" validates a 10-digit mobile number, and pattern="[A-Z]{5}[0-9]{4}[A-Z]{1}" validates an Indian PAN card without requiring custom JavaScript.
for attribute binds the label to the id of an input control. This allows screen readers to announce the label when the input is focused, and enables users to click or tap the label text to focus the textbox or toggle a checkbox/radio button, expanding small mobile touch targets.
application/x-www-form-urlencoded) turns all form input into an ASCII character string, which destroys binary file data (images, PDFs, ZIPs). Setting enctype="multipart/form-data" separates the HTTP body into distinct MIME parts with unique boundary markers, allowing binary byte streams to transmit safely to the server.
<header>, <nav>, <main>, <article>, <section>, <aside>, and <footer>) explicitly declare their meaning and purpose to both browsers and search engines. Unlike meaningless <div> tags, semantic elements:
<main>).async: Executes immediately the moment download completes, pausing HTML parsing mid-stream. Execution order is unpredictable. Ideal for independent analytics scripts (e.g., Google Analytics).defer: Waits until HTML parsing is completely finished before executing. Strictly guarantees original script execution order. Ideal for scripts dependent on DOM elements or other libraries (e.g., jQuery, Bootstrap).<meta name="viewport" content="width=device-width, initial-scale=1.0"> tells mobile browsers to set the viewport width to the actual physical screen width of the device (1:1 scale). Without this meta tag, mobile browsers assume a desktop monitor width (usually 980px) and render the website miniature and zoomed-out, requiring the user to pinch and zoom.
localStorage persists indefinitely until cleared; sessionStorage expires when the browser tab is closed; cookies expire based on their expiration timestamp.<title> and <meta name="description"> define the search result snippet and click-through rates.<h1> through <h6> establish content hierarchy and keyword significance.<article> signals syndicatable main story content.<a href="..."> descriptive anchor text provides link equity and PageRank distribution.colspan vs. rowspan, src vs. href).<font>, <center>, <marquee>, and <frame>; explain CSS3 alternatives instead.alt tags, and Core Web Vitals (CLS) demonstrates professional industry competence.