Conditional Rendering in React Complete Guide with Examples 2026

Image
  Conditional Rendering in React Conditional Rendering is one of the most useful concepts in React. It means showing different content on the screen depending on a condition. For example: If a user is logged in → show Logout If a user is not logged in → show Login If a student has passed → show Congratulations If a product is available → show Buy Now If data is loading → show Loading... React does not have a separate if rendering tag. Instead, we use normal JavaScript conditions such as if, the ternary operator, &&, and switch to decide what should appear in the UI.

Top 20 html MCQ with Answers


 

Top 20 HTML  MCQ With Answers 



1] <form> tag  specifies where to send form data

A) action
B) enctype
C)method
D) target

Answer: A) action

2] <form> tag specifies how form data should be sent?

A) enctype
B) method  action
C) method 
D) name

Answer: C) method

3] What are the valid value for the method attribute


A) get, send
B)send, receive
C) get, post
D) send, post 

Answer: C) get, post

3] default method if the method attribute is not specified?

A) POST  DELETE
B) PUT
C) GET
D) POST 

Answer: C) GET

4] Which input type is use for passwords?

A) text
B) password
C) secure
D) pass

Answer: B) password

5] Which element is used to create a dropdown menu in a form?

A) <dropdown>
B) <select>
C) <option>
D) <checkbox>

Answer: B) <select>

6] Which attribute makes an input field required?

A) required
B) mustfill
C) validate
D) mandatory

Answer: A) required

7] What input type allow users to select multiple options?

A) checkbox
B)  button
C) text
D) radio

Answer: A) checkbox

8] What does the name attribute in an input tag 

A) Gives a unique ID
B) Defines a CSS class
C) Identifies the input when sending data
D) Specifies the type of input

Answer: C) Identifies the input when sending data

9] create a multi-line text input field

A) <textarea>
B) <paragraph>
C) <text>
D) <paragraph>

Answer: A) <textarea>

11]  Which tag groups form element together?

A) <group>
B) <fieldset>
C)  <section>
D) <formgroup>

Answer: B) <fieldset>

12] What does the <legend>  

A)   Adds a title to a form
B) Groups options in a dropdown
C) Provides a caption for <fieldset>
D) Defines a label for an input 

Answer: C) Provides a caption for <fieldset>

13] Which tag is use to define a label for an input field

A) <text>
B) <name>
C) <label>
D) <input>

Answer: C) <label>

15] How do you associate a label with an input field

A) Using for attribute in <label>
B) Using id attribute in <input>
C) Both A and B

Answer: C) Both A and B

16] input type restricts users to selecting a date

A) text
B)  datetime
C) calendar
D) date

Answer: B) date

17] Which attribute sets a maximum value for an input field

A) max
B)   value
C) limit
D) maximum

Answer: A) max

 18] input type is used for numeric input

A) number
B) numeric
C) tex
D)  integer

Answer: A) number

 19] What does the <ol> tag stand

A) Ordered Listing

B) Ordered Link

C) Ordered List

D) Online List

Answer: C) Ordered List

20] Which tag is use to define an item inside an ordered list

A) <item>

B) <ol>

C) <li>

D) <ul>

Answer: C) <li>

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example