Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get caught up #77

Open
wants to merge 13 commits into
base: gh-pages
Choose a base branch
from
Binary file removed 6a4a9ef7-bfbf-40fb-9848-40cf995e2c01.dmp
Binary file not shown.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,35 +146,35 @@ __________________



##[html: Basic Questions for Begginers](http://www.thatjsdude.com/interview/html.html)
##[html: Basic Questions for Beginners](http://www.thatjsdude.com/interview/html.html)
15 basic questions and asnwers
______
1. Why do u need doctype?
2. What is the use of data-* attribute?
3. How can you generate public key in html?
4. How do you change direction of html text?
1. Why do you need doctype?
2. What are data-* attributes used for?
3. How can you generate a public key in html?
4. How do you change the direction of html text?
5. How can you highlight text in html?
6. Can you apply css to a part of html document only?
7. Will browser make http request for the following cases?
7. Will a browser make http request for the following cases?
8. Which resource would be downloaded first?
9. What is optional tag?
9. What is an optional tag?
10. What are the differences between div and span?
11. How would you differentiate div, section and article?
12. How to select svg or canvas for your site?
11. How would you differentiate between div, section, and article?
12. How would you select svg or canvas for your site?
13. How to serve html in multiple languages?
14. Explain standard and quirks mode.
15. What is semantic tag?
15. What is a semantic tag?

####[HTML: Answers for Basic Questions](http://www.thatjsdude.com/interview/html.html)


##[JavaScript: LinkedList (part -4: work in porcess)](http://www.thatjsdude.com/interview/linkedList.html)
##[JavaScript: LinkedList (part 4: work in process)](http://www.thatjsdude.com/interview/linkedList.html)
Very rough stage..need to finish (for intermediate)

##[JavaScript: search and Sort (part -5: work in porcess)](http://khan4019.github.io/front-end-Interview-Questions/sort.html)
##[JavaScript: search and Sort (part 5: work in process)](http://khan4019.github.io/front-end-Interview-Questions/sort.html)
Very rough stage..need to finish (for expert)

##[JavaScript: Binary Search Tree (part -6: work in porcess)](http://khan4019.github.io/front-end-Interview-Questions/bst.html)
##[JavaScript: Binary Search Tree (part 6: work in process)](http://khan4019.github.io/front-end-Interview-Questions/bst.html)
Very rough stage..need to finish (for expert)
__________________

Expand Down
15 changes: 14 additions & 1 deletion bst.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,20 @@ <h2>Breadth First Search</h2>
<p><strong>Question:</strong> How do you implement Breadth First Search</p>
<p><strong>Answer:</strong></p>
<pre><code>

BinarySearchTree.prototype.breadthFirstSearch = function() {
var queue = [];
queue.push(this);
while (queue.length) {
var node = queue.shift();
console.log(node.value);
if (node.left) {
queue.push(node.left);
}
if (node.right) {
queue.push(node.right);
}
}
};
</code></pre>
<p>ref: <a href="http://stackoverflow.com/a/13633354/1535443">stackoverflow</a></p>
<p>ref: <a href="https://github.com/duereg/js-algorithms">js algorithms</a></p>
Expand Down
2 changes: 1 addition & 1 deletion html.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ <h2>5. mark</h2>
<div id="scopped">
<h2>6. scoped</h2>
<p><strong>Question:</strong> Can u apply css rule to a part of html document?</p>
<p><strong>Answer:</strong> yes. by using "scopped" in the style tag.</p>
<p><strong>Answer:</strong> yes. by using "scoped" in the style tag.</p>
ref <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style">MDN: style</a>
</div>
<div id="http_request">
Expand Down
22 changes: 11 additions & 11 deletions js2.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,17 @@ <h4>null</h4>
<div id="doubleVsTripleEqual">
<h2>2. == Vs ===</h2>
<p><strong>Question:</strong> What are the differences between <code>==</code> and <code>===</code>?</p>
<p><strong>Answer: </strong> The simplest way of saying that, == will not check types and === will check whether both sides are of same type. So, == is tolerant. But under the hood it converts to its convenient type to have both in same type and then do the comparison.</p>
<p>=== compares the types and values. Hence, if both sides are not same type, answer is always false. For example, if you are comparing two strings, they must have identical character sets. For other primitives (number, boolean) must share the same value.</p>
<p><strong>Rule for implicit coercion:</strong> Comparison by using == does implicit type conversion under the hood. And rules for implicit coercion are as follows-</p>
<p><strong>Answer: </strong> The simplest way of saying it is that == will not check types and === will check whether both sides are of the same type. So, == is tolerant. But under the hood it converts to a convenient type, in order to have both as the same type, and then does the comparison.</p>
<p>=== compares the types and values. Hence, if both sides are not same type, the answer is always false. For example, if you are comparing two strings, they must have identical character sets. For other primitives (number, boolean), they must share the same value.</p>
<p><strong>Rule for implicit coercion:</strong> Comparison by using == does implicit type conversion under the hood. The rules for implicit coercion are as follows-</p>
<ul>
<li>If both operands are same type use ===</li>
<li>undefined == null</li>
<li>If one operands is string another is number, convert string to number</li>
<li>If one is boolean and another is non-boolean, convert boolean to number and then perform comparison</li>
<li>While comparing a string or number to an object, try to convert the object to a primitive type and then try to compare</li>
</ul>
<p>Be careful while comparing objects, identifiers must reference the same objects or same array.</p>
<p>Be careful while comparing objects identifiers must reference the same objects or same array.</p>
<pre><code>
var a = {a: 1};
var b = {a: 1};
Expand All @@ -185,7 +185,7 @@ <h2>2. == Vs ===</h2>
<h2>3. Object Equality</h2>
<p><strong>Question: </strong> How would you compare two objects in JavaScript?</p>
<p><strong>Basics:</strong> JavaScript has two different approaches for testing equality. Primitives like strings and numbers are compared by their value, while objects like arrays, dates, and user defined objects are compared by their reference. This means it compares whether two objects are referring to the same location in memory.</p>
<p><strong>Answer:</strong> Equality check will check whether two objects have same value for same property. To check that, you can get the keys for both the objects. If the number of properties doesn't match, these two objects are not equal. Secondly, you will check each property whether they have the same value. If all the properties have same value, they are equal.</p>
<p><strong>Answer:</strong> Equality check will check whether two objects have the same value for the same property. To check that, you can get the keys for both the objects. If the number of properties doesn't match, these two objects are not equal. Secondly, you will check whether each property has the same value in both objects. If all the properties have the same value, they are equal.</p>
<pre><code>
function isEqual(a, b) {
var aProps = Object.getOwnPropertyNames(a),
Expand Down Expand Up @@ -238,7 +238,7 @@ <h3>True False Rapid Fire</h3>
<p><strong>Question: </strong> <code>Boolean(/foo/)</code></p>
<p><strong>Answer: </strong> <code>true</code></p>
<P><strong>Question:</strong> <code>true%1</code></P>
<P><strong>Answer:</strong> 0. When you are trying to find reminder of true, true becomes 1 and reminder of 1 while dividing by 1 is 0. you will get same result if you doe <code>false%1</code></P>
<P><strong>Answer:</strong> 0. When you are trying to find reminder of true, true becomes 1 and reminder of 1 while dividing by 1 is 0. You will get same result if you do <code>false%1</code></P>
<P><strong>Question:</strong> <code>''%1</code></P>
<P><strong>Answer:</strong> 0</P>
</div>
Expand All @@ -248,17 +248,17 @@ <h2>5. Truthy isn't Equal to true</h2>
<p><strong>Question: </strong> As <code>[]</code> is true, <code>[]==true</code> should also be true. right?</p>
<p><strong>Answer:</strong> You are right about first part, <code>[]</code>, empty array is an object and object is always truthy. Hence, if you use <code>if([]){console.log('its true')}</code> you will see the log.</p>
<p>However, special case about <code>==</code> (double equal) is that it will do some implicit coercion.</p>
<p>Since left and right side of the equality are two different types, JavaScript can't compare them directly . Hence, under the hood, JavaScript will convert them to compare. first right side of the equality will be cooereced to a number and number of <code>true</code> would be 1.</p>
<p>After that, JavaScript implementation will try to convert <code>[]</code> by using<code>toPrimitive</code> (of JavaScript implementation). since <code>[].valueOf</code> is not primitive will use <code>toString</code> and will get <code>""</code></p>
<p> Now you are comparing "" == 1 and still left and right is not same type. Hence left side will be converted again to a number and empty string will be 0.</p>
<p>Finally, they are of same type, you are comparing <code>0 === 1</code> which will be false.</p>
<p>Since the left and right sides of the equality are two different types, JavaScript can't compare them directly. Hence, under the hood, JavaScript will convert them to compare. First, the right side of the equality will be cooereced to a number and number of <code>true</code> would be 1.</p>
<p>After that, JavaScript implementation will try to convert <code>[]</code> by using<code>toPrimitive</code> (of JavaScript implementation). Since <code>[].valueOf</code> is not primitive, it will use <code>toString</code> and will get <code>""</code></p>
<p> Now you are comparing "" == 1 and still, the left and right are not the same type. Hence, the left side will be converted again to a number and empty string will be 0.</p>
<p>Finally, they are of same type. You are comparing <code>0 === 1</code> which will be false.</p>
<p>ref: <a href="http://javascriptweblog.wordpress.com/2011/02/07/truth-equality-and-javascript/">angus croll: truth and eqality in JS</a>, ref: <a href="http://www.sitepoint.com/javascript-truthy-falsy/">truthy and falsy</a></p>
</div>

</div>
<div id="extendObject">
<h2>6. Extend Core Object</h2>
<p><strong>Question:</strong> How could you write a method on instance of a date which will give you next day?</p>
<p><strong>Question:</strong> How could you write a method on an instance of a date which will give you the next day?</p>
<p><strong>Answer:</strong> I have to declare a method on the prototype of Date object. To get access to the current value of the instance of the date, i will use <code>this</code></p>
<pre><code>
Date.prototype.nextDay = function(){
Expand Down
7 changes: 7 additions & 0 deletions js3.html
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,13 @@ <h3>algorithm related Question (will some future blog)</h3>
</ul>
<h3>Medium level question for js3</h3>
<ul>
<li>Define a function that returns n lines of Pascal’s Triangle. (this question was the entire interview)</li>
<li>Define a function that takes an array of strings, and returns the most commonly occurring string that array (this question came with an execution time limit)</li>
<li>Use recursion to log a fibonacci sequence of n length.</li>
<li>Explain the use cases for, and differences between — bind, apply and call.</li>
<li>What is the event loop?</li>
<li>Which new JavaScript / browser features are you most excited about and why?</li>
<li>What are the differences between functional and imperative programming styles, and explain your preference, if any.</li>
<li>what is same origin policy with regards to JS</li>
<li>~~3.14 ?? what and why. <a href="http://stackoverflow.com/questions/5971645/what-is-the-double-tilde-operator-in-javascript">answer here</a> or <a href="http://www.joezimjs.com/javascript/great-mystery-of-the-tilde/">great mystery of tilde</a></li>
<li>difference between cookies, sessionStorage and local storage</li>
Expand Down
3 changes: 3 additions & 0 deletions todo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ul>
<li>read this <a href="https://blog.devmastery.com/how-to-win-the-coding-interview-71ae7102d685#.h30qv3u5t">here</a></li>
<ul>