November 13, 2017

Front End Developer Advanced Interview Questions Answers


Front End Developer Advanced Experienced Level Interview Questions And Answers

What Is A Callback Function?

JavaScript is read line by line. Sometimes, this can result in what seems like a subsequent line of code being executed prior to an earlier line of code. A callback function is used to prevent this from happening, because it is not called until the previous line of code has fully executed.

Tell Me Why Do We Recommend External Css Or Javascript Versus Inline?

Inline CSS or Javascript has bad impact on site performance.

Your HTML code will weigh more as you use inline scripts, whereas external scripts reduces HTML file size which helps fast rendering of webpage.

HTML code will never be cached so inline scripts. Contrary to that, external dependencies, such as CSS and JavaScript files, will be cached by the visitor's web browser. So it reduces https requests each time user click through web pages.

It is hard to maintain Inline CSS and Javascript code. Where having code in just one centralized location is a lot more preferable than changing exactly the same kind of code snippets spread all over the files in the web site.

Explain What "this" Is In Javascript?

In JavaScript, 'this' normally refers to the object which 'owns' the method, but it depends on how a function is called.

Do You Know What Is Cors? How Does It Work?

Cross-origin resource sharing (CORS) is a mechanism that allows many resources (e.g., fonts, JavaScript, etc.) on a web page to be requested from another domain outside the domain from which the resource originated. It's a mechanism supported in HTML5 that manages XMLHttpRequest access to a domain different.

CORS adds new HTTP headers that provide access to permitted origin domains. For HTTP methods other than GET (or POST with certain MIME types), the specification mandates that browsers first use an HTTP OPTIONS request header to solicit a list of supported (and available) methods from the server. The actual request can then be submitted. Servers can also notify clients whether "credentials" (including Cookies and HTTP Authentication data) should be sent with requests.

What Is The Difference Between Json And Jsonp?

JSONP is JSON with padding.

Explain How To Use A Function A Class?

function functionName(name) {
this.name = name;
}

// Creating an object

var functionName = new functionName("WTEN");

console.log(functionName.name); //WTEN

Tell Me How Do You Clear A Floated Element?

clear:both

Explain Why Table-less Layout Is Very Important?

There are several reasons why web designers should stop using tables for layouts, and adopt the use of CSS for controlling HTML layouts.

It adheres to current W3C web standards and it improves accessibility of the information to a wider variety of users, using a wide variety of user agents.
There are bandwidth savings as large numbers of semantically meaningless <table>, <tr> and <td> tags are removed from dozens of pages leaving fewer, but more meaningful headings, paragraphs and lists.
Layout instructions are transferred into site-wide CSS stylesheets, which can be downloaded once and cached for reuse while each visitor navigates the site.
If coded well, CSS makes it easy to apply global changes to the layout
Web pages often have less code, and are much thinner when XHTML and CSS are used
Sites may become more maintainable as the whole site can be restyled or re-branded in a single pass merely by altering the mark-up of the specific CSS, affecting every page which relies on that stylesheet.
New HTML content can be added in such a way that consistent layout rules are immediately applied to it by the existing CSS without any further effort.
Explain What Is An Anonymous Function?

Anonymous functions are functions without a name. They are stored in a variable and are automatically invoked (called) using the variable name.

var x = function(a, b) {
console.log(a * b)
}
x(3, 5); // 15

Explain What Is Ajax? Write An Ajax Call?

AJAX stands for asynchronous JavaScript and XML and allows applications to send and retrieve data to/from a server asynchronously (in the background) without refreshing the page. For example, your new Gmail messages appear and are marked as new even if you have not refreshed the page.

Explain What Event Bubbling Is?

Event bubbling causes all events in the child nodes to be automatically passed to its parent nodes. The benefit of this method is speed because the code only needs to traverse the DOM tree once.

What Is Stringify?

stringify is used to transform JSON into a string.

Explain What Is The Lazy Loading?

Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is needed.

Lazy loading is loading code only once user needs it. For Example, there is a button on the page, which shows different layout once user pressed it. So there is no need to load code for that layout on initial page load.

Explain What Is The Difference Between Null And Undefined?

null is an object with no value. undefined is a type.

typeof null; // "object"

typeof undefined; // "undefined"

What Is Variable Scope?

JavaScript variables have functional scope.

Explain What Is An Iife?

IIFE stands for immediately-invoked function expression; it executes immediately after created by adding a () after the function.

What Are This And That Keywords?

This and that are important to variable scope in JavaScript. Here are a few stackoverflow posts on this, that and self.

What Is Event Delegation?

Event delegation allows you to avoid adding event listeners for specific nodes. Instead, you can add a single event listener to a parent element.

Why Do We Need To Use W3c Standard Code?

The goals of such standards are to ensure cross-platform compatibility and more compact file sizes. The focus of these standards has been to separate "content" from "formatting" by implementing CSS. It eases maintenance and development.

How To Clear A Floated Element?

A floated element is taken out of the document flow. To clear it you would need to do a clear:both or try overflow:auto on the containing div.

What Is A Float?

Floats are used to push elements to the left or right, so other elements wrap around it.

Tell Us The Purpose Of Each Of The Http Request Types When Used With A Restful Web Service?

The purpose of each of the HTTP request types when used with a RESTful web service is as follows:

GET: Retrieves data from the server (should only retrieve data and should have no other effect).

POST: Sends data to the server for a new entity. It is often used when uploading a file or submitting a completed web form.

PUT: Similar to POST, but used to replace an existing entity.

PATCH: Similar to PUT, but used to update only certain fields within an existing entity.

DELETE: Removes data from the server.

TRACE: Provides a means to test what a machine along the network path receives when a request is made. As such, it simply returns what was sent.

OPTIONS: Allows a client to request information about the request methods supported by a service. The relevant response header is Allow and it simply lists the supported methods. (It can also be used to request information about the request methods supported for the server where the service resides by using a * wildcard in the URI.)

HEAD: Same as the GET method for a resource, but returns only the response headers (i.e., with no entity-body).

CONNECT: Primarily used to establish a network connection to a resource (usually via some proxy that can be requested to forward an HTTP request as TCP and maintain the connection). Once established, the response sends a 200 status code and a "Connection Established" message.

How To Optimize The Page Using Front End Code Or Technology?

Below is the list of best practices for front-end technology, which helps to optimize page.

Improve server response by reducing resource usage per page
Combine all external CSS files into one file
Combine all external JS files into one file
Use responsive design instead of making device based redirects
Use asynchronous Javascript and remove block level Javascript
Use Minify version of stylesheet and javascript.
Optimize Image and use correct format of Image. Use the lazy loading design pattern for large size of images.
Use browser side cache with Cache control.
Avoid plugins to drive functionality.
Configure view port and use CSS best practices.
Prioritize visible content.
Load style-sheets in header and script in footer.

What Is A Clear?

A clear is used when you don't want an element to wrap around another element, such as a float.

What Is The Difference Between Html And Xhtml?

HTML is HyperText Markup Language used to develop the website.

XHTML is modern version of HTML 4. XHTML is an HTML that follows the XML rules which should be well-formed.

What Is A Javascript Object?

A collection of data containing both properties and methods. Each element in a document is an object. Using the DOM you can get at each of these elements/objects and do some cool sh*t.

What Is The Difference Between Form Get And Form Post?

Get:

With GET the form data is encoded into a URL by the browser. The form data is visible in the URL allowing it to be bookmarked and stored in web history. The form data is restricted to ASCII codes. Because URL lengths are limited there can be limitations on how much form data can be sent.

Post:

With POST all the name value pairs are submitted in the message body of the HTTP request which has no restrictions on the length of the string. The name value pairs cannot be seen in the web browser bar.

POST and GET correspond to different HTTP requests and they differ in how they are submitted. Since the data is encoded in differently, different decoding may be needed.

Explain The Difference Between == And === ?

The 3 equal signs mean "equality without type coercion". Using the triple equals, the values must be equal in type as well.

== is equal to
=== is exactly equal to (value and type)
0==false // true
0===false // false, because they are of a different type
1=="1" // true, auto type coercion
1==="1" // false, because they are of a different type
Do You Know What Is A Closure?

Closures are expressions, usually functions, which can work with variables set within a certain context. Or, to try and make it easier, inner functions referring to local variables of its outer function create closures.

Do You Know What Is The Difference Between == And === ?

== is equal to
=== is exactly equal to (value and type)

Tell Me Are You Familiar With Jasmine Or Qunit?

Jasmine and QUnit are JavaScript testing frameworks. I would familiarize yourself with the basics.

What Is The Difference Between A Host Object And A Native Object?

Native - existing in JavaScript. Host - existing in the environment.

Have You Ever Used A Css Preprocessor/precompiler? What Are The Benefits?

CSS preprocessors, such as SASS, have numerous benefits, such as variables and nesting.

Do You Know What Is The Importance Of The Html Doctype?

DOCTYPE is an instruction to the web browser about what version of the markup language the page is written. Its written before the HTML Tag. Doctype declaration refers to a Document Type Definition (DTD).

What Is The Difference Between Responsive And Adaptive Development?

In a nutshell, responsive is fluid and flexible, whereas adaptive adapts to the detected device/screen size.

Tell Me Where Do You Place Your Javascript On The Page?

It may depend on what you are using it for. There is some debate on this but generally a good question to ask to get an understanding of the JS knowledge.

Explain The Difference Between Inline, Block, Inline-block And Box-sizing?

inline is the default. An example of an inline element is <span>.
block displays as a block element, such as <div> or <p>.
inline-block displays an element as an inline-level block container. Here's an article on the topic.
box-sizing tells the browser sizing properties.

Explain What Is Web A Application?

A great question to feel out the depth of the applicants knowledge and experience.

A web application is an application utilizing web and [web] browser technologies to accomplish one or more tasks over a network, typically through a [web] browser.

Explain What Is The Importance Of The Html Doctype?

The doctype declaration should be the very first thing in an HTML document, before the html tag.

The doctype declaration is not an HTML tag; it is an instruction to the web browser about what version of the markup language the page is written in.

The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers can render the content correctly.

What Are The Difference Between Get And Post?

A GET request is typically used for things like AJAX calls to an API (insignificant changes), whereas a POST request is typically used to store data in a database or submit data via a form (significant changes). GET requests are less secure and can be seen by the user in the URL, whereas POST requests are processed in two steps and are not seen by the user. Therefore, POST requests are more secure.

Explain What Is The Difference Between A Prototype And A Class?

Prototype-based inheritance allows you to create new objects with a single operator; class-based inheritance allows you to create new objects through instantiation. Prototypes are more concrete than classes, as they are examples of objects rather than descriptions of format and instantiation.

Prototypes are important in JavaScript because JavaScript does not have classical inheritance based on classes; all inheritances happen through prototypes. If the JavaScript runtime can't find an object's property, it looks to the object's prototype, and continues up the prototype chain until the property is found.

What Is The Difference Between Call And Apply?

apply lets you invoke the function with arguments as an array. call requires the parameters to be listed explicitly. Also, check out this stackoverflow answer.

Explain The Difference Between Visibility:hidden; And Display:none?

Visibility:Hidden; - It is not visible but takes up it's original space.
Display:None; - It is hidden and takes no space.

Tell Me The Difference Between Visibility:hidden; And Display:none;?

Visibility:Hidden; - It is not visible but takes up it's original space.
Display:None; - It is hidden and takes up absolutely no space as if it was never there.

How To Increase Page Performance?

Sprites, compressed images, smaller images;
include JavaScript at the bottom of the page;
minify or concatenate your CSS and JavaScript; and
caching.
Do You Know What Is A Sprite? How Is It Applied Using Css? What Is The Benefit?

A image sprite is a collection of images put into one single image.
Using css positioning you can show and hide different parts of the sprite depending on what you need.
Sprites reduces the number of http requsts thus reducing load time of page and bandwidth
Buy Buttons using Sprite as background:

Both buttons use the same background image. The only differece is in the positioning.

Here is the actual background image:

And the CSS.

<style>
.orangeBuyBtn {
background: url('buyButtons-bg.gif') repeat-x 0 0;
border-color: #5B5752 #6B6B6B #808080;
border-style: solid;
border-width: 1px;
color: #FFFFFF;
cursor: pointer;
font-size: 14px;
font-weight: bold;

}
.greenBuyBtn {
background: url('buyButtons-bg.gif') repeat-x 0 -24px;
border-color: #5B5752 #6B6B6B #808080;
border-style: solid;
border-width: 1px;
color: #FFFFFF;
cursor: pointer;
font-size: 14px;
font-weight: bold;
}
</style>

Explain The Difference Between Static, Fixed, Absolute And Relative Positioning?

static is the default.
fixed is positioned relative to the browser.
absolute is positioned relative to its parent or ancestor element.
relative is positioned relative to normal positioning/the item itself. Used alone it accomplishes nothing.

How Do Browsers Read Css?

From right to left.

Explain Some Common Ie6 Bugs And How You Dealt With Them?

Ie6 is not dead, just ask China which represents a nice chunk of the worlds online population. Your pages should at least be functional on IE6, unless you dont care about half the worlds population.



Subscribe to get more Posts :