react basics coursera week 3 quiz answers

Knowledge check: Navigation

1. Is the following description true or false? A Single Page Application allows the user to interact with the website without downloading entire new webpages. Instead, it rewrites the current webpage as the user interacts with it. The outcome is that the application will feel faster and more responsive to the user.

  • True
  • False

2. How do React components turn into the webpage that you see?

  • In simple terms, a React component gets downloaded from the server every time a user interacts with a React app.
  • In simple terms, a React component has a one-to-one relationship to a HTML element that is displayed on the webpage and React keeps track of which HTML elements need to be updated.
  • In simple terms, React downloads a VDOM instance from the server to render all its pages.

3. A SPA can’t have regular anchor tag elements like a traditional web app can. The reason for this is that an anchor tag will load another html file from a server and refresh the page.

  • True
  • False

4. A total page refresh is not the way that a SPA works.

  • True
  • False

5. Complete the sentence: an SPA comes with its own special implementation of anchor tags and links, which only give an illusion of loading different pages to the end user, when in fact they simply...

  • load different components into a single element of the real DOM into which the virtual DOM tree gets mounted and updated
  • load different components into a single element of the virtual DOM into which the real DOM tree gets mounted and updated
  • load a single component into multiple elements of the real DOM into which the virtual DOM tree gets mounted and updated

Knowledge check: Conditional updates

6. Select all the conditional structures that exist in JavaScript. Select all that apply.

  • ternary operator
  • switch statement
  • if-else statement
  • logical && operator

7. What will be the output if you ran this code in the browser console:

true && 5

  • true
  • false
  • undefined
  • 5

8. If the value of the test variable evaluates to true, what will the following code render?

< div > {
test && < h1 > Hello < /h1>} World < /div>

  • World
  • Hello
  • An empty div
  • Hello World

Shuffle Q/A 1

9. If the value of morning is false, what will the following code render?

{
morning ? < h2 > Breakfast time! < /h2> : < h2>Lunch time!< /h2 >
}

  • Lunch time!
  • Breakfast time!

10. Choose the correct syntax to build a new Date object in JavaScript?

  • new Date;
  • New Date();
  • new Date();
  • Date();

Leave a Reply