


















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















































































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
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) `
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.
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.
Explanation: The child combinator (>) 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;
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;
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.
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
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
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;
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) <thead> D) <tfoot> Answer: A Explanation: <caption> defines a table’s title or description.
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 > h2 { margin-bottom: 20px; } D) h2 > header { margin-bottom: 20px; }
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.
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