Saturday 22 February 2020

Top CSS Interview Questions

These CSS interview questions are based on my personal interview experience. Likelihood of question being asked in the interview is from top to bottom.

1. Do you know about Box model ? What are the different values of box-sizing css?

    Margin-border-padding-content

2. What are the css precedence rules and css specificity ?

Css specificity is the set of rules applied to determine which style is applied to an element.
Order of css specificity from highest to lowest is as follows:-



  • A css rule with !important always takes precedence.
  • If element is having inline style ( element style attribute ) overrides all other styles (1,0,0,0)
  • A css selector using element id (element id attribute) (0,1,0,0)
  • A css selector using class, pseudo class or attribute (0,0,1,0)
  • A css selector using element name (for e.g. h1, p, div) (0,0,0,1)
  • A css selector appear later in the code override earlier one if both have the same specificity
  • Good read to understand how to calculate specificity:- 

    3. Difference between visibility:hidden; and display:none;

    visibilty:hidden element is not visible but space is allocated.
    display:none      element is not displayed and space is not allocated.

    4. How to align a block element inside another element.

    5. Difference between Static, Relative, Absolute and Fixed position

    6. What is shadow dom

    7. Pseudo elements

    ::before
    ::after

    8. Pseudo classes

    :active
    :hover
    :nth-child(n)

    9. Media query in CSS3

    10. em vs rem vs px ? Which unit of measurement you should use and when in css ?




    Top Javascript Interview Questions

    These Javascript interview questions are based on my personal interview experience. Likelihood of question being asked in the interview is from top to bottom.

    1. What is closure and how do we use it ?

    2. What is promises and why do we use it ?

    3. How to use async and await and what problem it solves ?

    4. Difference between call, apply and bind ?

    5. What is Arrow functions and how it is different from normal functions ?

    6. Difference between "==" and "===" ?

    7. Difference between var, let and const keywords ?

    8. Difference between null and undefined ?

    9. Object Oriented programming in Javascript - What is constructor and prototype? Do you know about prototypal inheritance. How do you define Class using ES6.

    10. What are the methods available in Object -

    create It is used to create a shallow copy of Object. Shallow copy means it copies only the properties and functions of the object but doesn't copy prototype inheritance.
    assign- It is used to copy the properties and functions of one object in another object. doesn't copy prototype inheritance.
    setPrototypeOf
    freeze- It is used to freeze object. New properties cannot be added and existing properties cannot be modified.
    seal- It is used to seal the schema of object. New properties cannot be added but existing properties can be modified.
    defineProperty- It is used to define property. Can make the property readonly using this method.

    11. Currying functions in javascript?

    12. Lexical scoping and variable hoisting in Javascript?




    Top CSS Interview Questions

    These CSS interview questions are based on my personal interview experience. Likelihood of question being asked in the interview is from to...