Which code segment places text to the right of an image whose file name is `blue.png`?
Answer : B
> ''When using `float: left` on an image, the image aligns to the left, allowing subsequent inline content (such as text) to flow on the right side of the image.''
>
> ''The syntax `src='images/blue.png'` assumes the image is located in the 'images' directory. A path such as `src='blue.png/images'` is incorrect and would result in a broken image.''
So, option B is correct both in terms of syntax and intended behavior.
* MDN Web Docs: float property
* W3C HTML5 Specification: element and image paths
---
Which HTML tag should a developer use to create a drop-down list?
Answer : D
The <select> tag is used in HTML to create a drop-down list. It is used in conjunction with the <option> tags to define the list items within the drop-down menu.
Purpose of <select>: The <select> element is used to create a control that provides a menu of options. The user can select one or more options from the list.
Structure of Drop-down List:
The <select> element encloses the <option> elements.
Each <option> element represents an individual item in the drop-down list.
Usage Example:
<label for='cars'>Choose a car:</label>
<select id='cars' name='cars'>
<option value='volvo'>Volvo</option>
<option value='saab'>Saab</option>
<option value='fiat'>Fiat</option>
<option value='audi'>Audi</option>
</select>
In this example, the <select> tag creates a drop-down list with four options: Volvo, Saab, Fiat, and Audi.
Attributes of <select>:
name: Specifies the name of the control, which is submitted with the form data.
id: Used to associate the <select> element with a label using the <label> tag's for attribute.
multiple: Allows multiple selections if set.
MDN Web Docs on <select>
W3C HTML Specification on Forms
What does declaring indicate to the browser?
Answer : B
From the W3C HTML5 Recommendation, section ''2.5 The DOCTYPE'':
''A DOCTYPE is a required preamble. DOCTYPEs are required for legacy reasons. When omitted, browsers tend to use a different rendering mode that is incompatible with some specifications. Including the DOCTYPE in a document ensures that the browser makes a best-effort attempt at following the relevant specifications.
A DOCTYPE must consist of the following components, in this order:
The string <!DOCTYPE (case-insensitive).
One or more whitespace characters.
The string html (case-insensitive).
Optionally, a legacy DOCTYPE string.
Zero or more whitespace characters.
A > character.
In other words, <!DOCTYPE html> exactly.''
And from MDN Web Docs' ''<!DOCTYPE>'' entry:
''The <!DOCTYPE html> declaration informs the browser that the page is written in HTML5 and that it should be rendered in standards mode (instead of quirks mode). It is the simplest, case-insensitive form of DOCTYPE defined by HTML5.''
Together, these extracts confirm that <!DOCTYPE html> tells the browser the document uses HTML5 and directs it to render according to the HTML5 (standards) specification rather than falling back to legacy rendering modes.
W3C HTML5 Recommendation, section ''2.5 The DOCTYPE''
MDN Web Docs: ''<!DOCTYPE>''
A. Function-driven
Answer : B
JavaScript is often described as an object-based language, meaning it is centered around objects. While it supports object-oriented programming (OOP) concepts, it is more accurate to describe it as object-based due to its prototypal inheritance model rather than classical inheritance.
Object-Based: JavaScript is built around objects and supports the creation and manipulation of objects.
Object-Oriented Features: JavaScript supports OOP principles like encapsulation, inheritance, and polymorphism, but through prototype chains rather than class-based inheritance.
Functional and Event-Driven: JavaScript supports functional programming and is often used in an event-driven manner, particularly in the context of web browsers.
MDN Web Docs on JavaScript Object Model
W3C JavaScript Overview
Which CSS property defines whether users can see an element when it is rotated away from them?
Answer : D
> ''The `backface-visibility` CSS property determines whether or not the 'back' side of a transformed element is visible when facing the user. When set to `hidden`, the back face of the element is not visible when it is rotated.''
This is particularly relevant in 3D transformations like flipping cards.
* MDN Web Docs: backface-visibility
* CSS Transforms Module Level 1 (W3C Specification)
---
Which structure tag should a developer use to place contact information on a web page?
Answer : D
The <footer> tag is used to define a footer for a document or a section. A footer typically contains information about the author of the document, contact information, copyright details, and links to terms of use, privacy policy, etc. It is a semantic element in HTML5, which means it clearly describes its meaning to both the browser and the developer.
Purpose of <footer>: The <footer> element represents a footer for its nearest sectioning content or sectioning root element. It typically contains information like:
Contact information
Copyright information
Links to related documents
Information about the author
Usage Example:
<footer>
Contact us at: contact@example.com
© 2024 Example Company
</footer>
In this example, the <footer> tag encloses contact information and copyright details.
Semantic Importance: Using semantic elements like <footer> enhances the accessibility of the document and provides better context for search engines and other user devices.
MDN Web Docs on <footer>
W3C HTML5 Specification on <footer>
Which option changes the content of the first line to a valid CSS comment?
Answer : A
In CSS, comments must begin with /* and end with */.
''CSS comments are placed inside /* and */. These comments can span multiple lines and are ignored by the browser.''
HTML-style comments using <!-- --> and JavaScript-style comments using // are not valid in CSS and may cause parsing errors.
CSS Syntax Specification
MDN Web Docs -- CSS Comments
W3Schools -- CSS Comment Rules
9
Given the following CSS code:
.title {
colqr : white;
}
Which HTML element is affected?
Q
Q <titlex/title>
Q
0