Loading

Quipoin Menu

Learn • Practice • Grow

react / JSX Syntax in React
mcq
Direction: Choose the correct option

Q1.

What does the following JSX code compile to?
<h1>Hello World</h1>
A. React.createElement('h1', null, 'Hello World')
B. A function call
C. HTML string
D. JavaScript object
Direction: Choose the correct option

Q2.

Which attribute should you use instead of 'class' in JSX?
A. classname
B. cssClass
C. class
D. className
Direction: Choose the correct option

Q3.

How do you embed a JavaScript expression in JSX?
A. { }
B. [[ ]]
C. {{ }}
D. ${ }
Direction: Choose the correct option

Q4.

Which of the following is a valid way to apply inline styles in JSX?
A. <div styles={{color: 'red'}}>
B. <div style={color: 'red'}>
C. <div style="color: red">
D. <div style={{color: 'red'}}>
Direction: Choose the correct option

Q5.

What happens if you return multiple JSX elements without a parent wrapper?
A. They render side by side
B. They are automatically wrapped in a fragment
C. Syntax error
D. Only the first renders