Text preview & study summary

HTML and CSS Basics

A free sample of 5 questions from this quiz, shown in full with answer choices and explanations. No interactivity — everything is visible on this page for study and review.

Want to test your knowledge? Launch the Interactive Exam Simulator

Question 1

What does HTML stand for?

Answer choices

  • A. Hyperlink Text Markup Language

  • B. HyperText Markup Language (Correct)

  • C. Home Tool Markup Language

  • D. HyperText Machine Language

Explanation

HTML (HyperText Markup Language) is the standard markup language used to create the structure and content of web pages. "HyperText" refers to text that contains hyperlinks connecting documents; "Markup Language" refers to the system of tags used to annotate text with meaning. HTML is not a programming language — it does not contain logic or variables. The current standard is HTML5 (finalized 2014).

Question 2

What is the correct way to include an external CSS stylesheet in an HTML document?

Answer choices

  • A. `<style src="styles.css"></style>` in the `<body>`

  • B. `<link rel="stylesheet" href="styles.css">` in the `<head>` (Correct)

  • C. `<css href="styles.css">` anywhere in the document

  • D. `<script type="text/css" src="styles.css">` in the `<head>`

Explanation

External CSS is linked using the `<link>` element inside the `<head>` section: `<link rel="stylesheet" href="styles.css">`. The `rel="stylesheet"` attribute tells the browser the relationship (it's a stylesheet); `href` specifies the file path. This is preferred over inline styles (style attribute) and embedded styles (`<style>` blocks) because it separates concerns, enables caching, and allows one stylesheet to style multiple HTML pages.

Question 3

Which CSS property controls the stacking order of positioned elements on a page?

Answer choices

  • A. `stack-order`

  • B. `layer`

  • C. `z-index` (Correct)

  • D. `position-order`

Explanation

The `z-index` property determines the stacking order of elements along the Z-axis (towards/away from the viewer). Elements with a higher `z-index` value appear on top of elements with lower values. `z-index` only works on positioned elements (`position: relative`, `absolute`, `fixed`, or `sticky`) — it has no effect on static elements. Elements with the same `z-index` stack in source-code order (later elements appear on top).

Question 4

In CSS, what does the `:nth-child(2n+1)` selector match?

Answer choices

  • A. Only the second child element

  • B. Every even-numbered child element

  • C. Every odd-numbered child element (1st, 3rd, 5th, etc.) (Correct)

  • D. Children that are more than 2 levels deep

Explanation

The `:nth-child()` pseudo-class accepts an expression `An+B` where A is the cycle size and B is the offset. `2n+1`: when n=0: position 1; n=1: position 3; n=2: position 5; etc. — selecting all odd positions. This is equivalent to `:nth-child(odd)`. `2n` (or `even`) selects even positions. This selector is commonly used for alternating table row colors ("zebra striping"): `tr:nth-child(odd) { background: #f2f2f2; }`.

Question 5

Which HTML element defines the largest (most important) heading?

Answer choices

  • A. `<h6>`

  • B. `<header>`

  • C. `<h1>` (Correct)

  • D. `<heading>`

Explanation

HTML provides six heading levels: `

` through ``. `

` is the most important/largest heading, typically used for the main page title; `` is the smallest/least important. From an SEO perspective, `

` carries the most weight — each page should generally have only one `

`. Headings create document hierarchy and are important for accessibility (screen readers use them to navigate).