Front End Development Front-End Development Course 2 — Questions and Answers
Question 1: Which CSS property controls the stacking order of overlapping elements?
- z-index (Correct answer)
- stack-order
- layer
- position
Correct answer: z-index
z-index determines which element appears on top when elements overlap, with higher values placed in front.
Question 2: What does the CSS `box-sizing: border-box` rule do?
- Includes padding and border in the element's total width and height (Correct answer)
- Removes all margins from an element
- Centers the element within its container
- Adds a box shadow to the element
Correct answer: Includes padding and border in the element's total width and height
border-box makes width and height include padding and border, so the element never exceeds its declared size.
Question 3: In JavaScript, what is the output of `typeof null`?
- "object" (Correct answer)
- "null"
- "undefined"
- "boolean"
Correct answer: "object"
typeof null returns "object" due to a historical bug in JavaScript's type system that was never fixed for backward compatibility.
Question 4: Which HTML element is used to define a self-contained piece of content that could be independently distributed?
- <article> (Correct answer)
- <section>
- <aside>
- <main>
Correct answer: <article>
<article> represents self-contained content like a blog post or news story that makes sense on its own.
Question 5: What is the purpose of the CSS `::before` pseudo-element?
- Inserts generated content before an element's actual content (Correct answer)
- Selects the element that comes before another in the DOM
- Applies styles before the page loads
- Targets the parent element
Correct answer: Inserts generated content before an element's actual content
::before inserts a generated content box as the first child of the selected element, commonly used with the `content` property.
Question 6: Which HTTP status code indicates a successful GET request that returned content?
- 200 (Correct answer)
- 201
- 204
- 301
Correct answer: 200
200 OK is returned when the server successfully processed the request and is returning the requested content.
Question 7: In CSS Flexbox, what does `justify-content: space-between` do?
- Places equal space between items, with no space at the edges (Correct answer)
- Centers all items in the container
- Places equal space around every item including edges
- Stretches items to fill the container
Correct answer: Places equal space between items, with no space at the edges
space-between distributes items so the first is at the start, the last at the end, and equal space fills between the rest.
Which CSS property controls the stacking order of overlapping elements?