Docsity

Web Design Certification Practice Exam: CSS and XHTML, Exams of Technology

Toggle sidebar
bg1
WebPage Design Certification CSS XHTML
Introductory Practice Exam
**Question 1.** Which DOCTYPE declaration is used for a strict XHTML 1.0 document?
A) `<!DOCTYPE html>`
B) `<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">`
C) `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">`
D) `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN">`
Answer: C
Explanation: The XHTML 1.0 Strict DTD is declared with the public identifier shown in option C, linking to
the official DTD file.
**Question 2.** In XHTML, which of the following is the correct way to write an empty `<br>` element?
A) `<br>`
B) `<br/>`
C) `<br ></br>`
D) `<br / >`
Answer: B
Explanation: XHTML requires empty elements to be self‑closed with a trailing slash, e.g., `<br/>`.
**Question 3.** Which meta tag is essential for defining the character encoding of an XHTML
document?
A) `<meta name="author" content="John Doe">`
B) `<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">`
C) `<meta charset="UTF-8">`
D) `<meta name="viewport" content="width=device-width, initial-scale=1">`
Answer: B
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a

Partial preview of the text

Download Web Design Certification Practice Exam: CSS and XHTML and more Exams Technology in PDF only on Docsity!

Introductory Practice Exam

Question 1. Which DOCTYPE declaration is used for a strict XHTML 1.0 document? A) B) C) D) Answer: C Explanation: The XHTML 1.0 Strict DTD is declared with the public identifier shown in option C, linking to the official DTD file. Question 2. In XHTML, which of the following is the correct way to write an empty <br /> element? A) <br /> B) <br /> C) <br /><br /> D) <br /> Answer: B Explanation: XHTML requires empty elements to be self‑closed with a trailing slash, e.g., <br />. Question 3. Which meta tag is essential for defining the character encoding of an XHTML document? A) B) C) D) Answer: B

Introductory Practice Exam

Explanation: In XHTML 1.0 the http-equiv="Content-Type" meta tag with a charset parameter declares the document’s encoding. Question 4. Which element is used to link an external CSS file to an XHTML document? A) `

Introductory Practice Exam

B) href C) link D) url Answer: B Explanation: href (hypertext reference) holds the target address for a hyperlink. Question 10. What is the difference between an absolute and a relative URL? A) Absolute URLs begin with “/”, relative URLs begin with “http://”. B) Absolute URLs contain the full protocol and domain; relative URLs are relative to the current document’s location. C) Absolute URLs are used only for images; relative URLs are used for links. D) There is no difference; they are synonyms. Answer: B Explanation: An absolute URL includes scheme, host, and path, while a relative URL omits those parts and resolves based on the current page. Question 11. Which attribute of the `` tag provides alternative text for accessibility? A) title B) alt C) src D) caption Answer: B Explanation: The alt attribute describes the image for users who cannot see it.

Introductory Practice Exam

Question 12. Which HTML element is used to group form controls that belong together? A) B) C) D) Answer: A Explanation: creates a visual and semantic grouping of related form fields. **Question 13.** Which of the following elements is a block‑level element? A) B) C) D) Answer: C Explanation: expands to fill the width of its container and starts on a new line, characteristic of block‑level elements. Question 14. Which CSS selector targets all elements with the class “highlight”? A) #highlight B) .highlight C) highlight D) *highlight* Answer: B Explanation: A period preceding a name selects elements by class.

Introductory Practice Exam

Explanation: The child combinator (&gt;) selects only immediate children. Question 18. Which property controls the space between an element’s border and its content? A) margin B) padding C) border-spacing D) outline Answer: B Explanation: Padding creates inner space between the content area and the border. Question 19. What effect does box-sizing: border-box; have on an element’s width calculation? A) Width includes only content; border and padding are added outside. B) Width includes content, padding, and border, keeping the total width constant. C) Width is ignored; only height is considered. D) Width automatically expands to fill the container. Answer: B Explanation: With border-box, the declared width encompasses content, padding, and border. Question 20. Which CSS property changes the style of a font to be bold? A) font-weight: normal; B) font-style: bold; C) font-weight: bold; D) text-decoration: bold;

Introductory Practice Exam

Answer: C Explanation: font-weight specifies the thickness of the characters; bold makes them heavier. Question 21. The CSS rule h1, h2, h3 { margin-bottom: 0.5em; } is an example of: A) A descendant selector B) A grouped selector C) An attribute selector D) A pseudo‑class selector Answer: B Explanation: Multiple selectors separated by commas are grouped to share the same declaration block. Question 22. Which unit is relative to the font size of the element itself? A) px B) % C) em D) pt Answer: C Explanation: em units are based on the current element’s computed font size. Question 23. Which CSS property is used to hide an element while still preserving its space in the layout? A) display: none; B) visibility: hidden; C) opacity: 0;

Introductory Practice Exam

A) .mainNav B) #mainNav C) mainNav D) *mainNav* Answer: B Explanation: The hash symbol (#) selects elements by their unique ID. Question 27. Which CSS property controls the distance between lines of text? A) letter-spacing B) line-height C) word-spacing D) text-indent Answer: B Explanation: line-height defines the vertical spacing between baselines of adjacent lines. Question 28. In CSS, which function is used to specify a color using red, green, and blue components? A rgb(255,0,0) B) hex(#FF0000) C) color(255,0,0) D) rgba(255,0,0,1) Answer: A Explanation: The rgb() function takes three integer values (0‑255) for red, green, and blue.

Introductory Practice Exam

Question 29. Which of the following is a valid way to include a comment in a CSS file? A) // This is a comment B) /* This is a comment */ C) `` D) # This is a comment Answer: B Explanation: CSS comments are wrapped with /* and */. Question 30. Which HTML attribute makes a form control required in modern browsers? A) required="true" B) mandatory C) required D) validate Answer: C Explanation: The boolean attribute required (without a value) enforces that the field must be filled before submission. Question 31. Which CSS property would you use to change the cursor to a pointer when hovering over a link? A) cursor: hand; B) cursor: pointer; C) cursor: default; D) cursor: arrow; Answer: B

Introductory Practice Exam

Answer: A Explanation: The standard HTML comment syntax works in XHTML as well. **Question 35.** Which markup element is used to embed a video file in modern HTML5? A) B) C) D) Answer: C Explanation: is the semantic element for video playback, supporting attributes like controls. Question 36. Which CSS selector selects every <p> element that is the first child of its parent? A) p:first-child B) p:first-of-type C) :first-child p D) p:child(1) Answer: A Explanation: The pseudo‑class :first-child matches an element that is the first child of its parent. Question 37. Which attribute of the `` element indicates the relationship between the current document and the linked resource? A) type B) rel C) href

## Introductory Practice Exam

D) media Answer: B Explanation: rel (relationship) tells the browser that the linked file is a stylesheet (rel="stylesheet"). Question 38. Which CSS property controls the stacking order of positioned elements? A) z-index B) stack-order C) order D) layer Answer: A Explanation: z-index determines which positioned element appears on top when they overlap. Question 39. Which of the following is a valid HTML5 doctype? A) B) C) D) Answer: B Explanation: HTML5 uses the simple, case‑insensitive `` declaration. Question 40. In CSS, which property would you use to make text appear in all uppercase letters? A) text-transform: capitalize; B) text-transform: uppercase;

Introductory Practice Exam

A) action B) method C) target D) enctype Answer: A Explanation: The action attribute contains the URL of the server‑side processing script. Question 44. Which CSS selector matches any element whose class attribute contains the word “button” (as a whole word, not part of another word)? A) .button B) [class~="button"] C) [class*="button"] D) *[class="button"] Answer: B Explanation: The attribute selector [class~="button"] matches when “button” appears as a space‑separated token within the class list. Question 45. Which HTML element is used to provide a caption for a ? A) B) `` C) &lt;thead&gt; D) &lt;tfoot&gt; Answer: A Explanation: &lt;caption&gt; defines a table’s title or description.

Introductory Practice Exam

Question 46. Which CSS property defines the thickness and style of an element’s border? A) border-width B) border-style C) border D) outline Answer: C Explanation: The shorthand border can set width, style, and color in one declaration. Question 47. Which HTML element represents a self‑contained piece of content that could be independently distributed or reused? A) B) C) D) Answer: B Explanation: is intended for independent, reusable content such as a blog post. **Question 48.** Which CSS rule will make all elements have a bottom margin of 20 pixels, but only when they are inside a `` element? A) header h2 { margin-bottom: 20px; } B) h2 header { margin-bottom: 20px; } C) header &gt; h2 { margin-bottom: 20px; } D) h2 &gt; header { margin-bottom: 20px; }

Introductory Practice Exam

B) background-repeat: repeat-x; C) background-repeat: no-repeat; D) background-repeat: repeat; Answer: B Explanation: repeat-x repeats the background image along the x‑axis (horizontally) only. Question 52. Which HTML element is used to define a section of related content that is tangentially related to the main content? A) B) C) D) Answer: B Explanation: `` denotes content aside from the main flow, such as sidebars or pull quotes. Question 53. Which CSS property determines the default thickness of the line drawn under a hyperlink? A) text-decoration B) border-bottom C) underline D) text-underline Answer: A Explanation: text-decoration: underline adds an underline; its thickness is browser‑default unless overridden with other properties.

Introductory Practice Exam

Question 54. Which HTML element is used to define a block of pre‑formatted text, preserving whitespace and line breaks? A) B) C) D) Answer: A Explanation: renders text exactly as written, including spaces and line breaks. **Question 55.** Which CSS selector matches any element that is the last child of its parent? A) `*:last-child` B) `:last-child` C) `*:last-of-type` D) `:nth-last-child(1)` Answer: B Explanation: The pseudo‑class `:last-child` selects the final child element of a parent. **Question 56.** Which HTML attribute on the element defines the type of data the control expects? A) name B) value C) type D) placeholder Answer: C