Fundamentals of Front End Development MCQs with Answers
Practice important Fundamentals of Front End Development MCQs with answers and explanations.
Chapter: 40
Q461:
What is the correct CSS code to set a 25px padding for all sides of a paragraph?
A. p {padding: 25px 25px 25px 25px;}
B. p {padding: 25px;}
C. p {padding: 50px;}
D. p {padding: 0 25px;}
Correct Answer:
B
Chapter: 40
Q462:
Fill in the blank: The shorthand property for padding and margin can take ________ values to set the padding/margin for top, right and left, and bottom respectively.
A. 1
B. 2
C. 3
D. 4
Correct Answer:
C
Chapter: 40
Q463:
How would you set the top padding to 25px, the bottom padding to 75px, and both the right and left paddings to 50px in CSS shorthand?
A. padding: 25px 50px 75px;
B. padding: 75px 50px 25px;
C. padding: 25px 50px 75px 50px;
D. padding: 25px 75px 50px;
Correct Answer:
A
Chapter: 40
Q464:
Which of the following properties would you use to set different margins for each side of an element?
A. margin-width
B. margin-style
C. margin-side
D. margin-top, margin-right, margin-bottom, margin-left
Correct Answer:
D
Chapter: 40
Q465:
Fill in the blank: The CSS property used to clear space inside the border of an element is called ________.
A. margin
B. padding
C. border
D. outline
Correct Answer:
B
Chapter: 40
Q466:
What is the result of using margin: 0 auto; on a block-level element?
A. It centers the element horizontally
B. It sets the margin to 0px
C. It removes the margin
D. It sets the margin to 100%
Correct Answer:
A
Chapter: 41
Q467:
Which CSS property is used to set the width of an element?
A. height
B. min-width
C. width
D. max-width
Correct Answer:
C
Chapter: 41
Q468:
Fill in the blank: The CSS property width is used to control the ________ of an element.
A. height
B. width
C. color
D. margin
Correct Answer:
B
Chapter: 41
Q469:
Which of the following values can be used with the width property?
A. pixels
B. percentages
C. ems
D. All of the above
Correct Answer:
D
Chapter: 41
Q470:
What will be the result of the following CSS code: img { width: 200px; }?
A. The image will have a width of 200px
B. The image will have a height of 200px
C. The image will have a width and height of 200px
D. The image will be hidden
Correct Answer:
A
Chapter: 41
Q471:
Fill in the blank: The CSS min-height property sets the minimum ________ of an element.
A. width
B. height
C. padding
D. margin
Correct Answer:
B
Chapter: 41
Q472:
What background color will the following code produce: p {min-height: 100px; background-color: yellow;}?
A. Red
B. Blue
C. Yellow
D. Green
Correct Answer:
C
Chapter: 41
Q473:
What is the purpose of using the min-height property in CSS?
A. To set the minimum height of an element
B. To set the maximum height of an element
C. To set the exact height of an element
D. To set the height based on content
Correct Answer:
A
Chapter: 41
Q474:
Fill in the blank: The CSS width property can be used with values like ________, percentages, and ems.
A. inches
B. points
C. pixels
D. rems
Correct Answer:
C
Chapter: 41
Q475:
Which of the following properties would you use to ensure an element does not shrink below a certain height?
A. max-height
B. min-height
C. height
D. overflow
Correct Answer:
B
Chapter: 41
Q476:
What does the CSS code p { min-height: 100px; background-color: yellow; } do?
A. Sets the minimum width of a paragraph to 100px
B. Sets the background color to yellow and the minimum height to 100px
C. Sets the maximum height to 100px
D. Sets the width to 100px and the background color to yellow
Correct Answer:
B
Chapter: 41
Q477:
Fill in the blank: The min-height property is useful when you want to ensure that an element has at least a certain ________.
A. width
B. height
C. margin
D. padding
Correct Answer:
B
Chapter: 41
Q478:
What happens if the content of an element is taller than the value specified by the min-height property?
A. The content will overflow
B. The element will not display
C. The element will expand to fit the content
D. The content will be cut off
Correct Answer:
C
Chapter: 42
Q479:
Which CSS property can be used to center-align block elements?
A. margin-left: auto; margin-right: auto;
B. position: absolute;
C. right: 0px;
D. float: right;
Correct Answer:
A
Chapter: 42
Q480:
What issue may occur in IE8 and earlier versions when using the position property without a !DOCTYPE declaration?
A. An extra 17px margin is added on the right side.
B. Elements are not visible.
C. Elements are positioned incorrectly.
D. Margins are not applied correctly.
Correct Answer:
A