MERN Stack Interview Questions & Answer Series Part 5

Posted on July 3, 2023 By

MERN stands for MongoDB, Express, React, Node, after the four key technologies that make up the stack. MERN Stack Interview Part 5 CSS Questions.

Q41. What is CSS?

CSS stands for Cascading Style Sheets. CSS is used to define styles for web pages, including the design, layout and variations in display for different devices and screen sizes.

Q42. What is the use of css ruleset?

CSS is a rule or set of rules that describe the formatting of individual elements on a web page. The rule consists of two parts: the selector and the next declaration block.

Q43. What are the possible ways to apply CSS styles to a web page?

There are three ways to apply CSS to HTML:

  • Inline CSS
  • Internal CSS
  • External CSS

Q44. What does the cascading portion of CSS mean?

The cascading in CSS refers to the fact that styling rules cascade down from several sources.

This means that CSS has an inherent hierarchy and of a hierarchy and styles of a higher precedence will overwrite rules of a lower precedence.

Even the simplest HTML document may have three or more style sheets associated with it including:

  • The browser’s style sheet
  • The user’s style sheet
  • The author’s style sheet

Q45. What is contextual selector?

A contextual selector is defined as a selector which considers the context where the style is to be applied. In simple words, the specified style is applied to an element only if the element is in the specified context.

Here, the <p> tag will be made green only in the context of <div> tag. It will be red in all other contexts.

div p {
color: green;
}

Q46. How can the gap under the image be removed?

As images being inline elements are treated same as texts, so there is a gap left, which can be removed by as below:

<figure>
 <img style="display: block" src="..." alt="">
</figure>

Q47. How do I restore the default value of a property?

The keyword initial can be used to resets it to its default value which is defined in the CSS specification of the given property.

Q48. Which property used for change face of a font?

The font-family property is used to change the face of a font.

Q49. What is progressive rendering?

Progressive rendering is the name given to techniques used to improve the performance of a webpage to render content for display as quickly as possible.

Example:

  • Lazy loading of images – Images on the page are not loaded all at once. JavaScript will be used to load an image when the user scrolls into the part of the page that displays the image.
  • Prioritizing visible content – Include only the minimum CSS/ content/scripts necessary for the amount of page that would be rendered in the users browser first to display as quickly as possible.
  • Async HTML fragments – Flushing parts of the HTML to the browser as the page is constructed on the back end.

Q50.What is Combinator selector?

A combinator is the character in a selector that connects two selectors together. There are four types of combinators.

1. Descendant Combinator (space): Selects all <p> elements inside <div> elements

div p {
 background-color: yellow;
}

2. Child Combinator (>): Selects all <p> elements that are children of a <div> element

div> p {
 background-color: yellow;
}

3. Adjacent Sibling Combinator (+): Selects all <p> elements that are placed immediately after <div> elements

div + p {
 background-color: yellow;
}

4. General Sibling Combinator (-): Selects all <p> elements that are siblings of <div> elements.

div-p{
 background-color: yellow;
}

MERN Stack Interview Part 5. MERN Stack Interview MongoDB Express React Node Javascript.

Leave a Reply

Your email address will not be published. Required fields are marked *