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 10 HTML MCQ

  

Top 10 HTML  MCQ With Answers 


Top 10 HTML  MCQ With Answers part(10)

1] Where should the <script> tag be placed when linking an                                       external JavaScript file?

A) Inside <head>
B) Inside <body>
C) Before </html>
D) Any of the above

Answer: D) Any of the above


2] How do you correctly link an external JavaScript ?

A) <script src="script.js"></script>
B) <link rel="script" href="script.js">
C) <meta script="script.js">
D) <js src="script.js"></js>

Answer: A) <script src="script.js"></script>


3] Which tag is use to define the favicon for a website?

A) <meta icon>
B) <favicon>
C) <link rel="icon">
D) <icon> 

Answer: C) <link rel="icon">


4] What file types are commonly use for favicons?

A) .png
B) .ico
C) .svg
D) All of the above

Answer: D) All of the above


5] What is the default size of  favicon?

A) 16x16
B) 32x32
C) 64x64
D) 128x128

Answer: A) 16x16


6] Why is the  important<meta charset="UTF-8"> tag ?

A) Ensures proper character encoding
B) Loads stylesheets faster
C) Increases SEO ranking
D) Prevents broken links

Answer: A) Ensures proper character encoding


7] What does the <base> tag do in the <head> tag?

A) Sets the base URL for all relative links
B) Defines the primary content
C) Sets the background color
D) Specifies the document type

Answer: A) Sets the base URL for all relative links


8] What happens if the <title> tag is missing from the <head> tag?

A) The browser shows a blank tab title
B) The file name is displayed as the title
C) The webpage doesn’t load
D) The browser crashes

Answer: B) The file name is displayed as the title

9) How do you make a frame load a default web page?

a) By using the src attribute
b) By using the href attribute
c) By using the load attribute
d) By using the default attribute

Answer: a) By using the src attribute

10] What happens if the cols and rows attributes are not specified in a <frameset>?

a) The browser displays a blank page
b) Frames take up equal space by default
c) Frames do not appear
d) Frames are automatically hidden

Answer: b

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example