React - Sample Interview Question (Junior Level)

What will be the output of the following code?

function Monitor(props) {
  return <h1>Monitor is connected well!</h1>;
}

function NoMonitor(props) {
  return <h1>Please connect a monitor.</h1>;
}

function HWManager(props) {
  const isMonitorOn = props.isMonitorOn;
  if (isMonitorOn) {
    return <Monitor />;
  }
  return <NoMonitor />;
}

ReactDOM.render(  
  <HWManager  />,
  document.getElementById('root')
);

  1. Compiler error, the property isMonitorOn is missing
  2. Monitor is connected well!
  3. Please connect a monitor.
  4. Run-time error
Tests in React for Juniors

Test Name Difficulty Time (minutes) No. of Questions
React Online Test for Juniors React Junior 20 10