This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "Aniket", | |
"last name ": "Singh", | |
"isPlayer": "true", | |
"friends": [ | |
"You", | |
"Me" | |
], | |
"Place": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
answers : [ | |
`#include <cmath> | |
#include <cstdio> | |
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Why is it neccesary to make the full link by adding the homapage to the selected "href" .? | |
Answer: This is because browser has a feature of adding the homepage link to the href but node doen't have .So to make the href complete ,we add "www.homepage.com/" to href, where homepage is the current page link. | |
2. What is callback in Node js? | |
Answer: The callback is an asynchronous equivalent for a function, it is called at the completion of a given task. | |
3. Why we cant add comments(//) inside the JSON file? | |
Answer: Because Json doesn't supports comments and it is only a "data syntax" . | |
4. How can we write arrays inside Json file.? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. How can we convert JSON file to pdf File ? | |
Answer: Perform the following steps:- | |
a) $ npm install pdfkit //Install pdfkit | |
b) const PDFDocument = require('pdfkit'); // require it | |
c) const fs = require('fs'); | |
d) let pdfDoc = new PDFDocument; // create object | |
pdfDoc.pipe(fs.createWriteStream('SampleDocument.pdf')); // for writing to pdf | |
pdfDoc.text(JSON.stringify(Array)); // conversion JSON to string and then to text for pdf | |
pdfDoc.end(); // end the process | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What is the key difference between debouncing and throttling? | |
Answer: In debouncing, it only makes an API call if the time difference between two keystrokes events is greater than a certain limit. | |
Whereas, in Throttling, it only makes an API call if the time difference between two function calls is greater than a certain limit. | |
2. Which one is better? | |
Answer: It totally depends on the use case and scenario where you are applying these concepts. | |
3. What is the similarity between Debouncing and Throtting? | |
Answer: Both of these are meant for performance optimization. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What is the major difference between unload and beforeunload events ? | |
Answer: beforeunload is used before unload event as an alert to warn the user before performing umload events such as navigation, page close,reload,etc. | |
2. What does Ready State indicates ? | |
Answer: It indicates the current loading stage. | |
3. What is the difference between window.load and document.ready? | |
Answer: In simple words, window.load is called when all content of window is loaded whereas document.ready is called when DOM is loaded and document structure is ready. | |
4. How can we obtain a window for a given document ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. How can we prevent CSRF attack ? | |
Answer: Using XSRF protection Token inside cookies. | |
2. How can we use XSRF protection token? | |
Answer: It can be used to prevent CSRF attack by changing the default value of samesite inside cookies as "strict" which will restrict the website to access the cookies information unless it is permitted by the parent website. | |
3. How csrf Attacks are possible. What is the bug that makes it possible? | |
Answer: CSRF attacks are possible against web apps that use cookies for authentication because: | |
a) Browsers store cookies issued by a web app. | |
b) Stored cookies include session cookies for authenticated users. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. How can we change the position of the background image? | |
Answer: Using background-position: x y; where x and y is the position keywords. Suppose if you want to position the image in center then instead of x and y write center center | |
2. How can we repeat the same background image ? | |
Answer: Using background-repeat: property. Suppose if you want to repeat itself in | |
i) both x nad y axis then in property write repeat; | |
ii) just x axis then in propert write repeat-x and if y axis then write repeat-y | |
3. Suppose I have a background image of size 960px by 640px large.Its aspect ratio is 3 by 2. It's bigger than its original container(which is 150px high).How can I use my image fully here ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. How CORS work(steps/ways) for Simple Requests ? | |
Answer: For Simple Requests, the CORS Works on the following way, | |
a) Request is made to a third party site with ORIGIN Header. | |
b) On the target site, the ORIGIN value is compared with the allowed origins. | |
c) If the source is an allowed one, then the resource is granted access, else denied. | |
2. How CORS work(steps/ways) for Complex Requests ? | |
Answer: For Complex Requests, the CORS Works on the following way, | |
a) Before the actual request is sent, a pre-flight request is sent to the target site. | |
b) This pre-flight request is sent via the OPTIONS HTTP Request method. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Which selector has the highest specificity? | |
Answer: D selectors have the highest specificity amongst the CSS selectors | |
2. Why ID Selector has the highest specificity? | |
Answer: Because of the unique nature of the ID attribute definition, we are usually styling a really specific element when we call up the ID in our CSS. | |
3. What is the correct order of selector specificity from most to least? | |
Answer: CSS style applied by referencing external stylesheet has lowest precedence and is overridden by Internal and inline CSS. Internal CSS is overridden by inline CSS. Inline CSS has highest priority and overrides all other selectors. | |
4. When two styles have the same specificity who wins? |