Loading

Quipoin Menu

Learn • Practice • Grow

Direction: Choose the correct option

Q1.

Can you write an if-else statement directly inside JSX?
A. Yes, but only else
B. No, JSX doesn't support if-else directly
C. Yes, with curly braces
D. Yes, using <if> tag
Direction: Choose the correct option

Q2.

How can you achieve if-else logic in JSX?
A. Using a function that returns different JSX
B. Using && and ||
C. All of the above
D. Using ternary operator
Direction: Choose the correct option

Q3.

What is the output of:
{if (true) 'yes'}
?
A. <div>if (true) 'yes'</div>
B. <div>yes</div>
C. Syntax error
D. <div></div>
Direction: Choose the correct option

Q4.

Which approach is best for complex conditional logic in rendering?
A. Moving logic outside JSX and storing JSX in variables
B. Using switch inside JSX
C. Nested ternaries
D. Using && everywhere
Direction: Choose the correct option

Q5.

What does the following code do? let content; if (user) content = ; else content = ; return
{content}
;
A. Throws error
B. Always renders Login
C. Renders Profile if user exists, else Login
D. Always renders Profile