Tuesday, 30 December 2014

Node Js Interview Questions and Answers for Experienced

Node Js Interview Questions and Answers for Experienced


Question: What is node.js?
Node.js is a software for scalable server-side and networking applications.
Node.js applications are written in JavaScript.
It can be run within the Node.js runtime on Mac OS X, Windows and Linux with no changes.


Question: In which language Node.js is written?
C,C++, javaScript.


Question: Who is creater of Node.js?
Ryan Dahl


Question: What is current stable version of Node.js?
6.6.0 Version / 15 September 2016.


Question: How node.js works?
Node.js works on a V8 environment, it is a virtual machine that utilizes JavaScript as its scripting language.


Question: From where we can download Node.js?
http://nodejs.org/download/


Question: What do you mean by the term I/O?
Input/Output


Question: What does event-driven programming?
In event-driven programming, flow of the program is determined by events.


Question: Where Node.js can be used?
  • Web applications ( especially real-time web apps )
  • Network applications
  • Distributed systems
  • General purpose application



Question: What is Advantage of Node.js?
Following are advantage of Node.js as compare to other web scripting.
  • Faster
  • More concurrency user
  • Asynchronous
  • Least blocks
  • Helps to build scalable network programs


Question: What are two different types of functions in Node.js?
  • Asynchronous
  • Synchronous



Question: What is Callback in node.js?
It is used to handle the multiple request.


Question: What tool and IDE is used for Node.js?

  • Atom
  • Nodeclipse Enide Studio
  • JetBrains WebStorm
  • JetBrains IntelliJ IDEA
  • Microsoft Visual Studio with TypeScript
  • NoFlo – flow-based programming environment integrated with GNOME APIs




Question: How to get Post Data in Node.js?
app.use(express.bodyParser());
app.post('/', function(request, response){
    console.log(request.body.user);
    
}); 


Question: How to make Post request in Node.js?
 var request = require('request');
request.post(
    'http://www.example.com/action',
    { form: { key: 'value' } },
    function (error, response, body) {
    if (!error && response.statusCode == 200) {
    console.log(body)
    }
    }
);


Question: What is callback hell?
Callback hell refers to heavily nested callbacks that have become unreadable



Question: How to handle the "Unhandled exceptions" in Node.js?
It can be caught at the "Process level" by attaching a handler for uncaughtException event.
Example:
process.on('uncaughtException', function(err) {
  console.log('Caught exception: ' + err);
});


Question: How to download image from Web?
#Include Important library
var fs = require('fs'),
request = require('request');

#Create a Download Function
var downloadImage = function(uri, filename, callback){
  request.head(uri, function(err, res, body){
    console.log('content-type:', res.headers['content-type']);
    console.log('content-length:', res.headers['content-length']);

    request(uri).pipe(fs.createWriteStream(filename)).on('close', callback);
  });
};

Use the function in following way:
downloadImage('https://www.google.com/images/srpr/logo3w.png', 'google.png', function(){
  console.log('image is downloaded');
});



Question: How to Remove directory which is not empty?
var rimraf = require('rimraf');
rimraf('/some/directory', function () {
 console.log('Directory is removed'); 
});



Monday, 29 December 2014

HTML interview questions and Answers

HTML interview questions and Answers

Question: What is full form of HTML?
Hyper Text Markup Language


Question: What is a html tag?
A tag tells the browser what to do with the data. html, body, title, a, ol and b are the most commons tags used in HTML.


Question: How can I include comments in HTML for 1 line and multiple line?
One line comment
<!-- This is a comment. -->
Multiple line comment
<!-- 
This is a comment
This is a comment
This is a comment
. -->



Question: Who is making the Web standards?
The World Wide Web Consortium



Question: What is the difference between XML and HTML?
XML is used for exchanging data, HTML is used to displaying the data in browser.


Question: How can you create an e-mail link?
<a href="mailto:email@domain.com">Email Me </a>



Question: Which html tags make a list that lists the items with numbers?

Example
<ol>
<li>hello</li>
<li>hello</li>
<li>hello</li>
</ol>



Question: What is a Hypertext link?
Hypertext link is used to navigate between one page to another page. Navigation can be same OR different website's pages.



Question: How do I center a table in html?
<div class="center">
...<br />
<table></table>
</div>
div.center {
text-align: center;
}


Question: How can I check for errors?
http://validator.w3.org/



Question: Can I have two or more actions in the same form?
No. you can't



Question: Can I have two or more form in the same page?
Yes, you can add multiple forms in a page.


Question: Is it possible to make the HTML source not viewable?
No


Question: How can I allow file uploads to my web site?
Use following to html code to display file upload button
<form action="upload.php" enctype="multipart/form-data" method="post">
File to upload: <input name="upload" type="file" /><br />
<input type="submit" value="Press" /> to upload the file!
</form>
Then use server side language to upload file to server.


Question: How do I create a link?
<a href="http://web-technology-experts-notes.in/">Web Technology Experts Notes</a>


Question: Is it possible to make the html source not viewable?
No, you can't.