HTML Coding Quiz — Questions and Answers
Question 1: Which character entity would you use to fill in blanks on a webpage?
- & nbsp; (Correct answer)
- & gt;
- & reg;
- & lt;
Correct answer: & nbsp;
` ` is the HTML entity for a non-breaking space. It is used to insert a single space character that will not be collapsed by the browser (unlike multiple regular spaces) and will prevent a line break at its position. This is commonly used to add specific spacing or create blank areas on a webpage.
Question 2: What two things are required to create and view webpages?
- A text editor & a web browser (Correct answer)
- A text editor & a compiler
- A compiler & a web browser
- None of the options are correct
Correct answer: A text editor & a web browser
To create webpages, you need a text editor (such as Notepad, VS Code, or Sublime Text) to write and edit the HTML, CSS, and JavaScript code. To view and test these webpages, a web browser (like Chrome, Firefox, or Edge) is essential, as it interprets the code and renders the visual page. A compiler is typically used for different types of programming languages, not directly for standard web development.
Question 3: What will the result of this code be?
- Display here text
- Display some text here
- Display some text Here is a heading
- Here is a heading (Correct answer)
Correct answer: Here is a heading
The HTML tag `<H1>` defines the most important heading on a webpage. When a web browser renders the code `<H1>Here is a heading</H1>`, it will display the text 'Here is a heading' as a large, bold heading. This is the standard behavior for the `<h1>` element.
Question 4: You are in a situation where you need to accept user input that is typically 1-2 paragraphs long. Which of the form elements listed below would you select?
- Textbox
- Drop-down list
- Textarea (Correct answer)
- Button
Correct answer: Textarea
The `<textarea>` HTML element is specifically designed for multi-line text input, allowing users to enter several lines or paragraphs of text. This makes it the ideal choice for situations where user input is expected to be longer than a single line, such as comments, messages, or detailed descriptions. A standard textbox (`<input type="text">`) is only suitable for single-line input.
Question 5: Where is the title tag text displayed?
- At the very top of your website. (Correct answer)
- Not on the web page, but on the browser page
- On the browser as well as the web page itself.
- It only appears in the code; it does not appear in the browser at all.
Correct answer: At the very top of your website.
The text within the `<title>` tag in HTML defines the title of the web page. This title is displayed in the browser's title bar or on the tab of the browser window, not within the main content area of the webpage itself. It is crucial for user experience and search engine optimization (SEO).
Question 6: What are the various heading levels in HTML?
- Big, Bigger, Biggest
- Bold, Italic, Underline, Typewriter Text
- 1, 2, 3, 4, 5, 6 (Correct answer)
- None of the options are correct
Correct answer: 1, 2, 3, 4, 5, 6
HTML provides six levels of headings, ranging from `<h1>` to `<h6>`. The `<h1>` tag represents the most important heading, typically used for the main title of a page or section, while `<h6>` represents the least important heading. These tags are used to structure content hierarchically and improve readability.
Question 7: What coding would you use to make the statement bold and underlined?
- None of these is correct (Correct answer)
Correct answer: None of these is correct
To make text both bold and underlined in HTML, you would typically use a combination of tags. Bold text is achieved with `<strong>` or `<b>`, and underlined text with `<u>`. To apply both, you would nest them, for example, `<strong><u>statement</u></strong>`. Since no options were provided that demonstrate this correct nesting, 'None of these is correct' is the appropriate answer.
Which character entity would you use to fill in blanks on a webpage?