Free MCSD Programming in HTML5 Questions and Answers — Questions and Answers
Question 1: You are developing a web page by using HTML5 <br> You have the following requirements: <br> An H1 element must be placed at the top left corner of the page <br> The size and location of the H1 element must not change if additional elements are added to the page <br> You need to position the H1 element on the page <br> Which CSS3 style should you use?
- Option D
- Option A (Correct answer)
- Option B
- Option C
Correct answer: Option A
The position property specifies the type of positioning method used for an element (static, relative, absolute, or fixed). absolute: The element is positioned relative to its first positioned (not static) ancestor element. <br> <br> For absolutely positioned elements, the left property sets the left edge of an element to a unit to the left/right of the left edge of its containing element.
Question 2: You are styling a box object on a page by using CSS3. <br> You need to set the transparency of the object to 50%. <br> Which two CSS3 styles will achieve the goal? (Each correct answer presents a complete solution. Choose two.)
- Option D
- Option A
- Option B (Correct answer)
- Option C (Correct answer)
Correct answer: Option B
The RGBA declaration allows you to set opacity (via the Alpha channel) as part of the color value.
Question 3: You are developing an HTML5 web application and are styling text. <br> You need to use the text-transform CSS property. <br> Which values are valid for the text-transform property?
- Line-through
- Hidden
- Blink
- Capitalize (Correct answer)
Correct answer: Capitalize
text-transform controls capitalization, and "capitalize" (along with uppercase, lowercase, and none) is a valid value. "Line-through" is a text-decoration value, "hidden" is a visibility value, and "blink" is a (deprecated) text-decoration value — none belong to text-transform.
Question 4: You are developing a web page that has a group of H1 and H2 elements. The page also includes a CSS class named underlineMe. <br> You have the following requirements: <br> > The font color of all H1 and H2 elements must be changed to red <br> > The CSS class underlineMe must be applied to all H1 and H2 elements <br> You need to update the web page to meet the requirements <br> <br> Which code segment should you use?
- Option B
- Option A
- Option D (Correct answer)
- Option C
Correct answer: Option D
Option D both groups the h1 and h2 selectors to apply the red color to all of them and combines the element selectors with the underlineMe class so the class styling is applied to those elements. The other options either miss the grouping or fail to correctly attach the class to both element types.
Question 5: You are developing a web page that will be divided into three vertical sections. The main content of the site will be placed in the center section. The two outer sections will contain advertisements. <br> You have the following requirements: <br> > The main content section must be set to two times the width of the advertising sections. <br> > The layout must be specified by using the CSS3 flexible box model. <br> You need to ensure that the visual layout of the page meets the requirements. <br> Which CSS3 property should you use?
- Box-direction
- Box-orient
- Box-flex-group
- Box-flex-group (Correct answer)
Correct answer: Box-flex-group
In the CSS3 flexible box model, the flex (box-flex) property assigns each item a proportional share of the available space, so giving the center section twice the value of the side sections produces the 2:1 width ratio. Box-direction and box-orient only control the axis/direction of layout, not the proportional sizing.
Question 6: You are developing an HTML5 page. The page includes the following code. <br> The inner paragraph must be exactly 15 pixels from the top left corner of the outer paragraph. You set the left style for the inner paragraph to the appropriate value. <br> You need to set the position property of the inner paragraph. <br> <br> Which value should you use?
- Static
- Absolute (Correct answer)
- Relative
- Fixed
Correct answer: Absolute
Absolute: The element is positioned relative to its first positioned (not static) ancestor element.
Question 7: AppCache API event fired when downloading <br> Answer: ondownloading
- TRUE (Correct answer)
- FALSE
Correct answer: TRUE
The AppCache (Application Cache) API fires the "downloading" event — handled via ondownloading — when the browser begins fetching resources to populate or update the cache, so the statement is TRUE.
You are developing a web page by using HTML5
You have the following requirements:
An H1 element must be placed at the top left corner of the page
The size and location of the H1 element must not change if additional elements are added to the page
You need to position the H1 element on the page
Which CSS3 style should you use?