Web Development Questions - nehaverma8/Interview GitHub Wiki

  • What is HTML5? html NEW ELEMENTS LIKE HEADRE, NAV, FOOTER, VIDEO, that were not avilabele before. Can use Canvas, SVG,

  • What is CSS3 we can not use media queries. Can how app looks in dfierremt sizes. Animations, CSS box model.

  • Can you describe the workflow when you are developing. Start with photoshop mockup. Use sublime IDE. Start with HTML, add CSS. Add JS. JS to bottom of page so its faster loaded. Images are optimised in size. CSS and JS is minified. Lint is run for styleing. Test on devices - responsive . code is checked in and tagged to job task.

  • Diff between CSS Resetting and CSS normalization CSS Resetting removes padding, margins etc that browser adds by default like h1,h2 etc. This is used so that the elements are rendered in a similar way in all browsers CSS normalization is to make sure all html elements render consistently in all browsers.

  • Diff between display inline inline-block and block Display property describes how an element will be displayed. There is a default display property for each elemtn. Display: block: The element starts on a new line and takes the entire width available to it. Eg.

    ,

    , , etc. Display: inline: does not start on a new line and takes only that much width as needed. , , e.g li { display: inline; } - for horizontal menus.

    display: none: a way of hiding an element. the page will be displayed as if the element is not present.

    Display:inline: only accepts margin-left and margin-right and all paddings properties ; no width, height, Display : inline-block: accepts paddings, margins, height and width ; display: block : accepts all above and

    • How does HTTP work? HTTP allows communication between a variety of hosts and clients usually over TCP/IP. The default port for TCP/IP is 80. Communication between hosts and clients occur over via request /response pair. The client initiates a HTTP request message and the server processes this request and send the response back via HTTP response message. The message can be a html file, text file, etc The HTTP request could be any of GET, POST, PUT, DELETE. The HTTP request can consist of a URL, and other payload information The server response consists of a response code 200 - all okay, 404 - resource not found, 3xx - redirection

    • How does HTTPS negotiation process work? HTTPs: data transfer is encrypted. Browser has a list of trusted certificate authorities. Server has the purchased ssl certificate which contains the public key and the server also has the private key. Browser initiates a connection request and the server responds by sending the certificate over which has the public key. Browser checks the certificate to ensure it was from one of its TCA and if it checks out and uses the public key that was contained in the certificate to encrypt the proposed shared key. This shared key is sent to server which the server decrypts using the private key. now bth have the shared encrytpted key which they use for data transfer,

    • CORS Cross Origin Resource sharing Policy or procedure for allowing to requests from other origins Same origin policy is a security policy implemented by web browsers to prevent JS from loading data from a different domain other than where it was served from. CORS is a policy to relax the same origin policy allowing JS to consume a API from a differnt origin.

    • Explain the this keyword this keyword points to the current object which is executing.

    • Explain Closure

    • What is the pitfall of Closure Closures captures variables and chains of scopes and contexts. As long as closures are active, the memory cannot be garbage collected. There could lead to memory leaks if not used correctly.

    • Explain Prototyes: Every JS object has a prototype. The prototype is an object. All JS objects inherit thier props and methods from thier prototype. Objects created using the "new Object()" and object literal inherit from prototype called Object.prototype.

    • Explain diff between == and === == compare value === compare value and type of variables

    • Benefits of using "use strict" code we write will be in strict mode; we can avoid some mistakes. it eliminates this coersion. In a function where this is null / undefined, in non strict mode, this defaults to "window" where as in strict mode it is undefined. makes using eval safer disallows duplicate parameter names
      doesn't allow for creation of global variables

    • NaN if we divide by 0 we get NaN NaN object type is a Number. if( value !== value) // returns true for NaN

    • Promise Promise helps write asyncronous js code and avoid callback hell

    • What is callback hell

    • how does node.js

    • Code : palindrome , count occurance of character in string, find duplicates from array

    • Event Bubbling

    • Event propogation

    • IIFE : Immediately invoked function expression.

    function foo(){ // this is a statement or a defination }

    var foo = function(){ //this is an expression . It resolve to a value }

    function foo(){}(); // this does not run as an IIFE

    Change to (function food(){})();

    IIFE is used to control variable scope.

    • Why should you leave the global scope of the website as is and not change it? reduce collision maintain independence easier to write your own code.

    • Explain hoisting

    • Explain const and let const and let are scoped in the block that you are in.

    • Explain null, undeclared, undefined undeclared is use a variable that has not be declared; undefined where it is declared but not inistalized.

⚠️ **GitHub.com Fallback** ⚠️