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 15 HTML MCQ With Answers part(6)


Top 15 HTML  MCQ With Answers

Top 25 HTML  MCQ With Answers part(6)


 1] What is the correct file extension for a HTML files?

a) .htm
b) .html
c) .css
d) .web

Answer: a


2] What is the purpose of the <br>?

a) To break text into two columns
b) To insert a line break
c) To add a border
d) To insert a blank line

Answer: b


3] How can you create a numbered list in HTML language?

a) <ul>
b) <ol>
c) <li>
d) <nl>

Answer: b


4] Which attribute is use to specify a unique identifier for an HTML tag?

a) class
b) name
c) style
d) id

Answer: d] id


5] Which tag is used to link an external CSS file in the <head> section in html tag?

A) <css>
B) <link>
C) <style>
D) <script>

Answer: B) <link>


6] What is the purpose of the used to <meta charset="UTF-8"> tag?

A) Defines the page language
B) Specifies the character encoding
C) Links JavaScript files
D)  Loads external stylesheets 

Answer: B) Specifies the character encoding


7]  Which <meta> tag is use for search engine optimization (SEO)?

A) <meta viewport>
B) <meta name="description">
C) <meta http-equiv="refresh">
D) <meta charset>  

Answer: B) <meta name="description">


8] Which <meta> tag is use to refresh a page automatically?

A)  <meta auto-update>
B) <meta http-equiv="refresh" content="5">
C) <meta refresh>
D) <meta name="refresh"> 

Answer: B) <meta http-equiv="refresh" content="5">


9] What does <meta name="keywords"> tag?

A) Defines the page title
B) Helps search engines index the page
C) Specifies the page’s author
D) Controls viewport scaling

Answer: B) Helps search engines index the page


10] Which <meta> tag is use to define the author of a webpage?

A) <meta name="author">
B) <meta name="creator">
C) <meta name="publisher">
D) <meta author>

Answer: A) <meta name="author">


11] What is the default alignment of text in an HTML tag?

a) Center
b)  Justify 
c) Right
d)  Left

Answer: d] left


12] Where should the <link>  be placed in an HTML document?

A) Inside <body>
B) Inside <head>
C) At the bottom of <body>
D) Before <html>

Answer: B) Inside <head>


13]Which tag is use to define inline CSS in <head> section?

A) <css>
B) <link>
C) <style>
D) <script>

Answer: C) <style>


14] Which attribute in the <link> tag specifies the location of an external file?

A) href
B) src
C) path
D) location

Answer: A) href


15] Which <meta> tag is use to make a webpage responsive?

A) <meta viewport>
B) <meta http-equiv="X-UA-Compatible">
C) <meta name="responsive">
D)  <meta charset="UTF-8">

Answer: A) <meta viewport>



Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example