Docsity

HTML Tags Ultimate Exam, Exams of Technology

Toggle sidebar
bg1
HTML Tags Ultimate Exam
Question 1. **Which tag declares the document type for HTML5?**
A) <!DOCTYPE HTML PUBLIC>
B) <!DOCTYPE html>
C) <meta charset="utf-8">
D) <html>
Answer: B
Explanation: The HTML5 doctype is simply <!DOCTYPE html>, which tells browsers to render the page in
standards mode.
Question 2. **What is the purpose of the <meta charset="UTF-8"> tag?**
A) Sets the page’s background color
B) Defines the character encoding for the document
C) Links an external stylesheet
D) Embeds a video file
Answer: B
Explanation: The charset attribute specifies the character encoding, ensuring correct display of text
characters.
Question 3. **Which tag should contain the page title that appears in browser tabs?**
A) <h1>
B) <title>
C) <meta>
D) <header>
Answer: B
Explanation: The <title> element, placed inside <head>, defines the page’s title shown on tabs and in
search results.
Question 4. **What does the <base href="https://example.com/"> tag affect?**
A) The default font for the page
B) The base URL for all relative links on the page
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

Partial preview of the text

Download HTML Tags Ultimate Exam and more Exams Technology in PDF only on Docsity!

Question 1. Which tag declares the document type for HTML5? A) B) C) D) Answer: B Explanation: The HTML5 doctype is simply , which tells browsers to render the page in standards mode. Question 2. What is the purpose of the tag? A) Sets the page’s background color B) Defines the character encoding for the document C) Links an external stylesheet D) Embeds a video file Answer: B Explanation: The charset attribute specifies the character encoding, ensuring correct display of text characters. Question 3. Which tag should contain the page title that appears in browser tabs? A) B) C) <meta> D) <header> Answer: B Explanation: The <title> element, placed inside <head>, defines the page’s title shown on tabs and in search results. Question 4. What does the <base href="https://example.com/"> tag affect? A) The default font for the page B) The base URL for all relative links on the page

C) The language of the document D) The viewport settings for mobile devices Answer: B Explanation: sets a base URL, so all relative URLs are resolved against it. Question 5. Which attribute of the tag is used to control the viewport on mobile devices? A) name="viewport" B) charset="UTF-8" C) http-equiv="refresh" D) content="width=device-width, initial-scale=1" Answer: A (used together with content) Explanation: The viewport meta tag uses name="viewport" and a content value like width=device-width to enable responsive scaling. Question 6. Which element is the correct container for linking an external CSS file? A) tag?** A) Inside without any attributes B) At the end of before C) Inside after the closing tag D) Inside Answer: B

A) Renders text as a superscript B) Highlights the text with a default background color C) Deletes the text from the document flow D) Shows the text as a small caption Answer: B Explanation: indicates highlighted text, often displayed with a yellow background. Question 12. Which tag is appropriate for displaying computer code snippets? A) B) C) D) All of the above Answer: D Explanation: preserves whitespace, indicates code fragments, and denotes sample output; all are used for code-related content. Question 13. What is the purpose of the tag? A) To display keyboard input B) To display a quotation C) To display a variable name D) To display a block of preformatted text Answer: A Explanation: semantically represents user‑typed keyboard input. Question 14. Which tag should be used for subscript text, such as chemical formulas? A) B) C) D)

Answer: B Explanation: renders text as a subscript, lowering it relative to the baseline. Question 15. Which tag creates an ordered (numbered) list? A) B) C) D) Answer: B Explanation: defines an ordered list where items are automatically numbered. Question 16. What attribute can be used on to start numbering at a value other than 1? A) start B) value C) type D) index Answer: A Explanation: The start attribute sets the initial number of an ordered list. Question 17. Which list type uses definition terms and definitions? A) B) C) D) Answer: C Explanation: (definition list) contains (term) and (description) pairs. Question 18. What is the primary difference between and ? A) is block‑level; is inline‑level.

Answer: B Explanation: The part after # refers to an element whose id attribute matches the fragment. Question 22. Which attribute on provides alternative text for accessibility? A) title B) src C) alt D) href Answer: C Explanation: The alt attribute supplies descriptive text for screen readers and when the image cannot load. Question 23. When should you use the element? A) To embed a video file B) To define multiple image sources for responsive designs C) To create a slideshow automatically D) To display a thumbnail of a larger image Answer: B Explanation: works with elements to serve different images based on media queries or formats. Question 24. Which element pairs with to provide a caption? A) B) C) D) Answer: C Explanation: <figcaption> is used inside <figure> to add a caption describing the media.

Question 25. What attribute enables native playback controls on a element? A) autoplay B) controls C) loop D) muted Answer: B Explanation: Adding the controls attribute displays the browser’s built‑in video controls. Question 26. Which tag is used to embed subtitles or captions for a element? A) B) C) D) Answer: A Explanation: defines timed text tracks such as subtitles, captions, or descriptions. Question 27. What is the primary use of the element? A) To embed scalable vector graphics B) To draw graphics via JavaScript at runtime C) To display pre‑formatted text D) To host audio files Answer: B Explanation: provides a bitmap drawing surface that can be manipulated with JavaScript. Question 28. Which attribute on makes the graphic scale without loss of quality? A) width B) height C) viewBox D) src

Question 32. Which tag provides a caption for the entire table? A) B) <legend> C) <caption> D) <summary> Answer: C Explanation: <caption> is placed directly inside <table> to describe the table’s purpose. Question 33. What does the <colgroup> element allow you to do? A) Define a group of rows B) Apply styles or attributes to a set of columns C) Create a responsive image group D) Group form controls together Answer: B Explanation: <colgroup> groups <col> elements, enabling column‑specific styling or attributes. Question 34. Which form attribute determines where the submitted data is sent? A) method B) action C) enctype D) target Answer: B Explanation: The action attribute specifies the URL that processes the form submission. Question 35. What is the default HTTP method for a form if none is specified? A) POST B) GET C) PUT D) DELETE

Answer: B Explanation: When the method attribute is omitted, the form defaults to GET, appending data to the URL query string. Question 36. Which input type is best for collecting a user’s email address with built‑in validation? A) B) C) D) Answer: B Explanation: type="email" triggers browsers to validate the format of the entered email. Question 37. Which attribute on creates a slider control for numeric ranges? A) type="range" B) type="number" C) type="slider" D) type="progress" Answer: A Explanation: type="range" renders a graphical slider allowing selection within a defined min‑max range. Question 38. How can you provide a list of autocomplete suggestions for a text input? A) element B) linked via list attribute C) D) tag Answer: B Explanation: defines options that appear as suggestions when the user types, referenced by the input’s list attribute.

D) Answer: B Explanation: is intended for major navigation blocks such as menus or table of contents. Question 43. Which element should contain the primary content of a page, distinct from headers, footers, and sidebars? A) B) C) D) Answer: C Explanation: designates the central content unique to the page, improving accessibility. Question 44. When should you use the element? A) For a navigation menu B) For a self‑contained composition that could be syndicated (e.g., blog post) C) For decorative icons only D) For grouping unrelated form fields Answer: B Explanation: represents an independent piece of content that makes sense on its own. Question 45. Which element is appropriate for a sidebar containing related but not central content? A) B) C) D) Answer: A Explanation: is used for tangential content such as sidebars, pull quotes, or related links.

Question 46. What does the element provide? A) A hidden input field B) A collapsible disclosure widget that can be toggled open or closed C) An automatic table of contents D) A modal dialog box Answer: B Explanation: creates a widget that the user can expand or collapse, often paired with . Question 47. Which tag is used to create a native modal dialog box? A) B) C) D) Answer: C Explanation: represents a dialog box that can be shown or hidden via JavaScript. Question 48. Why is the tag considered obsolete? A) It conflicts with tags B) It is a presentational element; CSS should handle centering C) It only works in older browsers D) It breaks the document’s character encoding Answer: B Explanation: Modern HTML separates structure from presentation; CSS (e.g., text-align:center) should be used instead. Question 49. Which tag was used for frame-based layouts but is now deprecated? A)

Explanation: rel="noopener" mitigates a security risk where the opened page could manipulate the original window. Question 53. Which attribute on specifies the intrinsic width and height of the image? A) srcset B) alt C) width and height D) loading Answer: C Explanation: width and height attributes help browsers allocate space before the image loads, reducing layout shift. Question 54. What does the loading="lazy" attribute on do? A) Loads the image immediately B) Defers image loading until it is near the viewport C) Forces the image to load in a new tab D) Disables the image entirely Answer: B Explanation: lazy loading improves performance by loading images only when they are about to become visible. Question 55. Which attribute on inside a element defines the media condition? A) src B) type C) media D) sizes Answer: C Explanation: The media attribute contains a media query that determines when that source should be used.

Question 56. What is the purpose of the element’s preload attribute set to "metadata"? A) Download the entire audio file immediately B) Do not download any data until the user clicks play C) Only download metadata (duration, dimensions) initially D) Loop the audio automatically Answer: C Explanation: preload="metadata" fetches only the file’s metadata, conserving bandwidth. Question 57. Which tag creates a table row grouping for header cells? A) with inside B) C) D) Answer: B Explanation: groups header rows, typically containing cells. Question 58. Which attribute on disables browser autocomplete for all its fields? A) autocomplete="off" B) novalidate C) disabled="true" D) autocomplete="false" Answer: A Explanation: autocomplete="off" tells browsers not to store or suggest previously entered values. Question 59. Which element is used to embed an external web page within the current page? A) B) C) D)

A) method B) enctype C) action D) target Answer: B Explanation: enctype (e.g., "multipart/form-data") determines how the browser packages the form data. Question 64. What element should be used to group a set of related radio buttons? A) B) C) D) Answer: B Explanation: semantically groups related controls, enhancing accessibility. Question 65. Which attribute on defines its drawing resolution? A) width and height attributes (numeric) B) style="width:..." C) resolution D) dpi Answer: A Explanation: The width and height attributes set the pixel dimensions of the canvas’s internal drawing surface. Question 66. When using , which attribute specifies the fill color of a shape? A) stroke B) fill C) color D) background

Answer: B Explanation: The fill attribute determines the interior color of SVG shapes. Question 67. Which attribute on disables the default controls, allowing custom UI? A) controls="false" B) nocontrols C) controls (omitted) D) autoplay Answer: C Explanation: Omitting the controls attribute removes the native UI; developers can add custom controls via JavaScript. Question 68. What is the purpose of the element inside ? A) To provide alternative audio tracks B) To supply subtitles or closed captions for hearing‑impaired users C) To embed a preview image D) To define a video playlist Answer: B Explanation: kind="captions" indicates the track contains caption text synchronized with the video. Question 69. Which attribute on defines the step size between values? A) step B) interval C) increment D) precision Answer: A Explanation: The step attribute sets the granularity of slider increments.