Knowledge check: Adding components

11. Choose the correct statement about the following code:

< >

< h1>...< /h1>

< p>...< /p>

< />

  • This is a valid HTML tag
  • This is valid React code. 
  • This is valid JavaScript code
  • This is not valid React code

12. In React, you can only have one root element in a component.

  • True
  • False

13. Which of the following statements are true about JSX?

Choose all that apply.

  • JSX elements must be self-closing.
  • JSX allows you to include expressions in your code.
  • JSX elements can have multiple children.
  • JSX allows you to use JavaScript functions as attributes
  • JSX elements must be written in all uppercase. 

14. What is the output of the following JSX code block?

const myList = ['apple', 'banana', 'orange'];

const listItems = myList.map((item) =>

< li key={item}>{item}< /li>

);

return (

< ul>{listItems}< /ul>

);

  • <li>apple</li><li>banana</li><li>orange</li>
  • <ul><li>apple</li><li>banana</li><li>orange</li></ul>
  • [<ul>,<li>apple</li>, <li>banana</li>, <li>orange</li>,<ul>]
  • <ul> [<li>apple</li>, <li>banana</li>, <li>orange</li>] </ul>

15. Which of the following is true about props in React?

  • Props are mutable and can be changed within a component.
  • The prop value must be wrapped in quotes.
  • Props should be used for values that will not change within a component.
  • Props should only be used for simple data types, such as strings and numbers.

Module Quiz: Project Foundations

16. What are semantic tags in HTML?

  • They are the tags that include data about your website’s encoding.
  • A way to describe the meaning of your website through the tags you use.
  • Semantic tags hold metadata about the website, such as the website version number.
  • A way in which you can reduce the number of tags used by using more general tags like <div>.

17. What are the benefits of semantic HTML? Select all that apply.

  • Improves SEO
  • Improves performance
  • Allows for more styling options
  • Makes the code easier to read and understand
  • Improves accessibility

18. Which Open Graph tag should be used if you want to provide a title to a shareable link of your web page?

  • og:head
  • og:header
  • og:description
  • og:title

Shuffle Q/A 2

19. Which of the following are valid values for the CSS display property? Select all that apply.

  • float
  • flex
  • grid

20. Which of the following CSS selectors is an example of an adjacent sibling selector?

  • div p
  • div + p
  • div > p

Leave a Reply