HTML Fundamentals MCQs for NSCT
HTML Fundamentals covers how HTML (HyperText Markup Language) gives a page its structure and meaning: semantic elements, forms, attributes and the accessibility that follows from using them correctly. It is topic 3 of the Web Development area, which carries 10% of the NSCT according to HEC's Areas of Competencies. In 2026 candidates averaged 54.1% accuracy in this area, per the HEC NSCT report and APP.
This page follows the HTML Living Standard maintained by WHATWG, which is what browsers implement today. Older books list "HTML5" or XHTML rules that no longer apply, so treat the standard as the final word.
Semantic tags
A semantic element says what its content is, not how it looks. Browsers, search engines and screen readers use that meaning; CSS handles the look.
<header>Site name and logo</header>
<nav>Main menu links</nav>
<main>
<article>
<h1>Blog post title</h1>
<section><h2>First part</h2> ...</section>
</article>
<aside>Related posts</aside>
</main>
<footer>Copyright</footer>
| Element | Use it for |
|---|---|
<main> |
The page's unique content (one visible per page) |
<article> |
Self-contained content that could stand alone, such as a post or a comment |
<section> |
A thematic group, usually with a heading |
<div> / <span> |
No meaning; styling or scripting hooks only |
<strong> / <b> |
Strong importance / attention without importance |
Obsolete elements such as <center>, <font> and <marquee> are non-conforming; use CSS instead. <small>, <b> and <i> are still valid, but they now carry specific meanings.
Exam angle: expect "article or section?" and "which element is obsolete?" questions.
Forms
A form collects input and submits it to the URL in action using method. Only controls with a name are submitted, as name=value pairs.
<form action="/apply" method="post" enctype="multipart/form-data">
<label for="cnic">CNIC</label>
<input id="cnic" name="cnic" pattern="[0-9]{13}" required>
<input type="file" name="transcript">
<button>Submit</button>
</form>
| GET | POST | |
|---|---|---|
| Data goes in | URL query string (?q=web+dev) |
Request body |
| Good for | Searches and filters | Creating or changing data, file uploads |
| Bookmarkable | Yes | No |
Key facts: a <button> with no type is a submit button; unchecked checkboxes send nothing; radio buttons are exclusive only when they share a name; files need POST plus enctype="multipart/form-data". Built-in validation (required, type="email", min, max, step, pattern) runs in the browser, so the server must validate again.
Exam angle: application questions show a short form and ask what gets submitted, or why a value is missing.
Attributes
Attributes add information to an element as name="value" pairs in the start tag. Global attributes work on every element: id (unique in the document), class (shared, space-separated), lang, title, hidden, tabindex and custom data-* attributes, which scripts read through element.dataset.
Boolean attributes such as disabled, checked, required and readonly are true when present, whatever their value. So disabled="false" still disables the control; remove the attribute instead.
Void elements such as <br>, <img>, <input> and <meta> have attributes but no content and no end tag.
Exam angle: boolean-attribute and duplicate-id questions catch many students who think like programmers rather than like parsers.
Accessibility
Accessibility means people using screen readers, keyboards or magnifiers can use the page. In HTML it starts with the right elements:
- Give every meaningful image a short
alt, and decorative onesalt="". - Connect each control to a visible
<label>; a placeholder is not a label. - Use real
<button>,<a href>and<select>elements, which are focusable and keyboard-operable by default. - Keep headings in order (h1, h2, h3) and use landmarks such as
<header>,<nav>,<main>and<footer>. - Set the page language with
<html lang="en">.
The first rule of ARIA (Accessible Rich Internet Applications) is to use a native element before adding ARIA roles. ARIA changes what assistive technology announces, but it adds no keyboard behaviour. Use aria-label when a control, such as an icon-only button, has no visible text.
Exam angle: analysis questions describe a user who cannot reach or understand a control and ask for the root cause.
Common traps
- Writing
disabled="false"and expecting the field to be enabled. - Forgetting that a
<button>inside a form submits it unless it hastype="button". - Using
idwherenameis needed: an id alone never sends a value. - Leaving
altoff decorative images instead of writingalt="". - Treating
<b>and<strong>, or<i>and<em>, as identical because they look alike. - Nesting a
<div>inside a<p>: the parser closes the paragraph before the div.
Worked examples
1. Understanding. Which element should hold a caption for an image placed inside <figure>?
Answer: <figcaption>. It must be the first or last child of <figure>. <caption> is for tables, and <legend> is for fieldsets.
2. Application. A form uses method="get" with action="/jobs". It has a text field name="city" containing Multan and a select name="type" with remote chosen. What URL is requested?
Answer: /jobs?city=Multan&type=remote. GET appends named controls to the query string in document order.
3. Analysis. A "Show password" toggle is a <span> with a click handler. Keyboard users cannot use it, and screen readers say nothing useful. What is the best fix?
Answer: replace it with <button type="button">, give it a clear name such as "Show password", and reflect its state with aria-pressed. Adding tabindex alone would make the span focusable, but it still would not respond to Enter or Space or announce itself as a button.
Practise
The quiz below has 99 HTML Fundamentals questions, filterable by tier and difficulty.
Practise: 99 questions
FAQs
What is the difference between HTML5 and the HTML Living Standard?
HTML5 was a W3C snapshot published in 2014. Since then WHATWG has kept HTML as a continuously updated "living standard", and since 2019 the W3C has worked with it rather than publishing its own versions. In practice, "HTML5" now just means modern HTML, and the living standard is the current reference.
Are the b and i tags deprecated?
No. Both are conforming in current HTML, but with specific meanings. <b> draws attention to text without adding importance, such as keywords, and <i> marks an alternative voice, such as a technical term or a foreign word. For importance use <strong>, and for stress emphasis use <em>.
Does HTML validation make my form secure?
No. Attributes such as required and pattern run in the browser and improve the user experience, but users can edit the page or send requests directly. The server must always validate and sanitise input; this matters again in the Web Security topic later in the area.
Should I use a div or a section?
Use <section> when the content forms a themed part of the document that would naturally have a heading. Use <div> when you only need a wrapper for styling or scripting. If the content makes sense on its own, such as a blog post or a product card, <article> fits better.
Next step
Continue with CSS Fundamentals MCQs, go back to the Web Development MCQ hub, or test yourself across every area in an NSCT mock test.