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 25 HTML MCQ With Answers(part 4)

 

Top 20 HTML  MCQ With Answers

Top 20 HTML  MCQ With Answers (part 4)


1] Which of the following is not a valid HTTP method?

a) GET
b)DELETE
c) FETCH
d)  POST 

Answer: c) FETCH

2] What is the primary purpose of a firewall?

a) To block unauthorized access
b) To increase browsing speed
c) To filter email spam
d) To optimize search results

Answer: a) a) To block unauthorized access

3]  What is "phishing"?

a) A method to steal personal information
b) A tool to browse the web
c) A way to protect sensitive data
d) A program for managing emails

Answer: a) A method to steal personal information

4] Which device connects a local network to the Internet?

a) Router
b) Firewall
c) Modem
d) Switch
  

Answer: a) Router

5] What is the purpose of the <frame> tag in HTML?

a) To create hyperlinks
b) To divide the browser window into multiple sections
c) To add images to a web page
d) To embed videos in a web page 

Answer: b)   To divide the browser window into multiple sections


6]  Which tag is used to define a frameset in HTML?

a) <frameset>
b) <border> 
c) <iframe>
d) <frame>

Answer: a) <frameset>

7] Can the <frame> tag be used in HTML5?

a)  Only with JavaScript
b) No, it is obsolete in HTML5
c) Only in specific browsers
d) Yes, it is fully supported

Answer: b) No, it is obsolete in HTML5


8]What is the correct attribute to specify the URL of a document in a <frame>?

a) src
b) target
c) link
d) 
href 

Answer: a)  src


9] Which element replaces <frame> in HTML5?

a) <section>
b) <div>  
c) <iframe>
d) <main>

Answer: c)  <iframe>


10] What does the <frameset> tag replace in an HTML document?

a) <html>
b) <head>
c) <body>
d) <footer>

Answer: c) <body>

11] How do you define the number of columns in a frameset?

a) Using the cols attribute 
b) Using the rows attribute
c) Using the columns attribute
d) Using the span attribute

Answer: a ) Using the cols attribute 

12] How do you specify the size of frames in a frameset?

a) Using percentages or pixel values in the rows and cols attributes
b) Using CSS only
c) Using the width and height attributes
d) Using the size attribute

Answer: a) Using percentages or pixel values in the rows and cols attributes


13] What is the purpose of the noresize attribute in the <frame> tag?

a) To prevent resizing of the frame by the user
b) To disable the frame
c) To hide the frame
d) To prevent content loading

Answer: a)  To prevent resizing of the frame by the user


14] What attribute is used to specify the spacing between frames in a frameset?

a)  margin
b) framespacing
c)frameborder 
d) border

Answer: b) framespacing


15] Which attribute is used to add a border to a frame?

a) frameborder
b) border
c) style
d) style

Answer: a) frameborder

16] Can <frame> tags be nested inside other <frame> tags?

a) Yes, they can be nested
b) No, nesting is not allowed
c) Only in specific browsers
d) Only with an <iframe> tag

Answer: a) Yes, they can be nested


17] What does the scrolling attribute in a <frame> do?

a) Enables or disables scrollbars in the frame
b) Adds vertical scrollbars only
c) Adds horizontal scrollbars only
d) Locks the frame content

Answer: a) Enables or disables scrollbars in the frame


18] How do you provide alternative content for browsers that do not support frames?

a) Use the <noframes> tag
b) Use the <iframe> tag  
c) Use the <alt> tag
d) Use the <fallback> tag

Answer: a)  Use the <noframes> tag

 19] Which of the following is a valid value for the scrolling attribute in a <frame>?

a) auto, yes, or no
b) on or off
c) enable or disable 
d) true or false

Answer: a)  autoyes, or no

20] Which attribute is used to give a frame a unique identifier?

a) name
b) id
c) title
d) target

Answer: a) name

21] What is the default value of the frameborder attribute?

a) 1
b) 0
c) true
d) auto

Answer: a


22] Which attribute is used to specify the name of a frame?

a) name
b) id
c) title
d) target

Answer: a

 23] What is the purpose of the <noframes> tag?

a) To provide alternative content for non-frame-supporting browsers
b) To create nested frames
c) To hide frames
d) To add scrollbars to frames

Answer: a


24] Which HTML version deprecated the <frame> tag?

a) HTML 4.0
b) HTML 5
c) XHTML 1.0
d) HTML 3.2

Answer: b

25] What does the target="_blank" attribute in a link do?

a) Opens the link in a new tab or window
b) Opens the link in the same frame
c) Redirects the user to a blank page
d) Prevents the link from opening

Answer: a

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example