Front End Development Front End Development Core Technologies & Fundamentals 1 — Questions and Answers
Question 1: Which HTML5 element is used to define navigation links in a webpage?
- <nav> (Correct answer)
- <menu>
- <header>
- <aside>
Correct answer: <nav>
The <nav> element is the semantic HTML5 element specifically designed to wrap a set of navigation links.
Question 2: In CSS, which property controls the space between an element's border and its content?
- margin
- padding (Correct answer)
- spacing
- gap
Correct answer: padding
The padding property defines the space between an element's content and its border.
Question 3: Which JavaScript method is used to add a new element at the end of an array?
- pop()
- shift()
- push() (Correct answer)
- unshift()
Correct answer: push()
The push() method appends one or more elements to the end of an array and returns the new length.
Question 4: What does the CSS 'display: flex' property do?
- Makes an element invisible
- Enables the Flexbox layout model on a container (Correct answer)
- Fixes an element's position
- Creates a CSS grid
Correct answer: Enables the Flexbox layout model on a container
Setting display: flex on a container activates the Flexbox layout model, allowing flexible alignment of child elements.
Question 5: Which attribute is required in every <img> tag for accessibility?
- src
- alt (Correct answer)
- title
- id
Correct answer: alt
The alt attribute provides alternative text for screen readers and when images fail to load, making it essential for accessibility.
Question 6: What is the correct way to link an external CSS file to an HTML document?
- <style src='styles.css'>
- <css href='styles.css'>
- <link rel='stylesheet' href='styles.css'> (Correct answer)
- <script src='styles.css'>
Correct answer: <link rel='stylesheet' href='styles.css'>
The <link> element with rel='stylesheet' and href pointing to the CSS file is the standard way to include an external stylesheet.
Which HTML5 element is used to define navigation links in a webpage?