Output Based and Find the Error Questions

Twenty five questions where you predict what the browser produces, or find what is wrong. The format that exposes what you actually understand.

How to use this set

Questions only. Predict the answer first, write it down, then open the browser and check.

Writing your prediction before testing is the point of the exercise. Guessing correctly after seeing the output teaches nothing; being wrong about a prediction you committed to is what makes a rule stick.

Part A: What does the browser produce?

For each, describe the DOM the parser builds and how many nodes result.

  1. <p>Total: <div>1,200</div></p>
  2. <p>First paragraph
    <p>Second paragraph
  3. <strong><em>Text</strong></em>
  4. <ul>
      <li>One</li>
      <div>Two</div>
      <li>Three</li>
    </ul>
  5. <table>
      <tr><td>A</td></tr>
    </table>

    How many elements are in the DOM that you did not write?

Part B: What is rendered?

  1. <p>These      words        are
       spread   across
       several       lines.</p>
  2. <p>10&nbsp;kg of rice</p>
    <p>10 kg of rice</p>

    What is the difference when the container is narrow?

  3. <!-- outer
      <!-- inner -->
      <p>Is this visible?</p>
    -->
  4. <p>Price: <a href="/x">Rs 500</a></p>

    versus

    <p>Price: &lt;a href="/x"&gt;Rs 500&lt;/a&gt;</p>
  5. <textarea name="bio">
    </textarea>

    What exactly is in the field when the page loads?

  6. <ol start="7" reversed>
      <li>A</li>
      <li>B</li>
      <li>C</li>
    </ol>

    What numbers appear?

  7. <select>
      <option>Design</option>
      <option>Data</option>
    </select>

    What value does the server receive if the reader never touches it?

Part C: Find the error

Each of these contains at least one problem. Identify every one.

  1. <label>Email address</label>
    <input type="email" id="email">
  2. <img src="chart.png">
  3. <div class="btn" onclick="save()">Save</div>
  4. <a href="#" onclick="deleteRecord(4)">Delete</a>
  5. <h1>Site name</h1>
    <h4>Section title</h4>
    <h2>Photo caption</h2>
  6. <fieldset>
      <label><input type="radio" name="a" value="yes"> Yes</label>
      <label><input type="radio" name="b" value="no"> No</label>
    </fieldset>
  7. <form action="/login" method="get">
      <input type="text" name="user">
      <input type="password" name="pass">
      <button>Sign in</button>
    </form>
  8. <table>
      <tr><td>Course</td><td>Fee</td></tr>
      <tr><td>Design</td><td>48000</td></tr>
    </table>
  9. <head>
      <title>Fee structure - Rs 48,000</title>
      <meta charset="utf-8">
    </head>
  10. <iframe src="https://example.com/widget"></iframe>
  11. <form action="/cart/add" method="post">
      <input type="hidden" name="price" value="4999">
      <button type="submit">Add to cart</button>
    </form>
  12. <a href="https://example.org" target="_blank">Read the report</a>
  13. <button aria-label="Submit">Send enquiry</button>

    This is valid. What is the problem, and who does it affect?

Verification method

  1. Write your prediction down. Every time. This is not optional if the exercise is to work.
  2. Part A - open the Elements panel and compare the tree with your prediction. View source is not the answer.
  3. Part B - render it and look.
  4. Part C - run the validator, run an accessibility scan, then tab through it. Between the three, most problems surface. Some are neither invalid nor flagged by a scanner, and only a human notices - those are the ones worth spending time on.

Practice

  1. Predict all twenty five before opening a browser.
  2. Verify each and mark your prediction right or wrong.
  3. For every wrong prediction, write one sentence explaining the rule you had misunderstood.
  4. Write five new find the error questions and give them to someone else.

Useful resources

Hand picked references for this topic
Written by Lorens Mishra

Software Engineer Notes Management System Administrator

Continue reading

All HTML notes →
HTML

HTML MCQ Set 1: Beginner

Thirty multiple choice questions on document structure, elements, text, links, lists and images. Questions only - verify each answer by building it.

Read more

Discussion

0 comments
Sign in to join the discussion.

No comments yet. Be the first to say something.