HTML5 – Interview Questions

Preparing for an interview for a web developer or MEAN stack developer? Along with the JavaScript and other client-side and server-side technologies, developers are asked about HTML5 basic topics too. So, here are some important topics and questions that are frequently asked in an interview and the concepts that a developer must know about HTML5.


1) Once an application is offline, it remains cached until the following happens?

  a) The manifest file is modified.

  b) The application cache gets automatically cleared by the browser.

  c) The application cache is programmatically updated.

  d) The user clears their browser’s data storage for the site.


2) What is the internal format of input type=”date” in HTML5?






3) Which of the following method can be used to estimates the page load times?

  a) Using _gap.push([“_trackPageLoadTime”]) with Google Analytics.

  b) Page load times cannot be estimated.

  c) Using the Navigation Timing JavaScript API.

  d) Using built-in JavaScript methods.


4) Assuming that some text needs to be written on an HTML5 canvas, select a replacement for the commented line below:

<canvas id="e" width="200" height="200"> </canvas>
  var canvas = document.getElemantById("e");
   // insert code here
  context.fillStyle = "blue";
    context.font = "bold 16px Arial";

  a) var context = canvas.getContext();

  b) var context = canvas.getContext(“2D”);

  c) var context = canvas.getElementById(“context”);

  d) var context = canvas.getElementById(“2D”);


5) Which of the following is a possible way to get the fullscreen video played from the browser using HTML5?

  a) <object> <param name=”allowFullScreen” value=”true” />

  b) <video allowFullScreen=”true”>

  c) <video height=”100%” weight=”100%”>

  d) None of these.


6) The following are valid use cases of client file/directory access in HTML5, except?

  a) Drag and drop files from the desktop.

  b) Full file system access.

  c) Use of the HTML5 File API.

  d) Use of files as HTML5 input types.


7) When does the ondragleave mouse event get fired in HTML5?

  a) It gets fired when an element has been dragged to a valid drop target.

  b) It gets fired when an element leaves a valid drop target.

  c) It gets fired at the end of a drag operation.

  d) It gets fired while an element is being dragged.


8) Given following HTML and CSS, what will be the height of parent element having “wrap” class?

  .wrap{ box-sizing: border-box; }
  .col{ height:100px; margin:20px;}

<div class="wrap">
  <div class="col"> </div>
  <div class="col"> </div>

  a) 260px

  b) 140px

  c) 220px

  d) 280px


9) Which CSS2 selector, selects all Button elements that have a space separated list of values for attr where one of those values is equal to the given value?

  a) button[attr~=value]

  b) button[attr^=value]

  c) button[attr|=value]

  d) button[attr=value]


10) Which of the following CSS rule would make all h3 tags that are immediately preceded by a section tag italic?

  a) section~h3 {font-style: italic;}

  b) section>h3 {font-style: italic;}

  c) section+h3 {font-style: italic;}

  d) section h3 {font-style: italic;}


11) What is the use of data list in HTML5?

  a) Enables a tag contain additional data(meta data).

  b) Provides autocomplete feature in a textbox.

  c) Provides SEO friendly markup for page context.

  d) The alternate markup for building accessible lists.


12)  Generally, quirks mode could be turned on when there is:

  a) NO or Incorrect DOCTYPE declaration.

  b) Spaces or illegal chars before DOCTYPE

  c) Invalid HTML – with respect to the chosen DOCTYPE

  d) All of the above


13) Which CSS rule would make the fourth list item underlined if the list had a fourth item?

  a) ul li: nth(4th) { text-decoration:underline; }

  b) ul li: nth-child(4) { text-decoration: underline; }

  c) ul li: 4th-child { text-decoration: underline; }

  d) ul li: nth-of-type(4) { text-decoration: underline;}


14) Which property specifies whether the mask should scroll or stay fixed the page is scrolled?

  a) mask-clip

  b) mask-repeat

  c) mask-attachment

  d) mask-image


15) The property defines whether or not an ellipsis should be displayed when content overflows a region?

  a) text-overflow

  b) overflow-style

  c) content-overflow

  d) overflow


16) Which rule is used to define the properties that will be animated in an animation rule?

  a) @transition

  b) @key

  c) @keyframes

  d) @animation


17) What is the attribute used in the <video> element, that is set to the URL of an image that the browser will use in place of the video before it is loaded and playing?

  a) placeholder

  b) poster

  c) banner

  d) preload


Further Readings

Nodejs Interview Questions

Important Interview Questions for Node.js

1) What is Nodejs ?

2) What is NPM ?

3) Different types of API’s exist in Node (api methods)?

4) What is event looping ?

5) What is event emmiter in node.js ?

6) What is asynchronous calls in Node.js ?

7) Suppose we have 5 apis, we have to hit fifth api when all four have been completed.How can we do it ?

8) What are promises ?

9) What is promise all in node.js ?

10) What is clustering in node js?

11) Core features in node.js ?

12) Can I send body params in GET request ? if yes then how ?

13)  What are middle-wares in node.js ?

14) What is the use of next in node.js ?

15) Different types of exit polls in node.js ?

16) Explain Process in node.js ? 

17) Why node is single threaded ?

18) New features in node.js ?

19) What are create, read streams ?

20) Inheritance in node.js ?

21) How can I secure my cookies in node.js ?

22) What is the passport in node.js ?

23) Best way to manage the session in node.js ?

24) What do you mean by child processes in node.js ?

25) What is the cross-domain problem ?

26) If I want to solve the cross-domain problem for only specific type of APIs , how can I do it ?

27) How can we integrate Third party APIs in node.js ?

28) Explain callback in node.js ?

29) What is callback-hell in node.js? how can I solve this?

30) How can we install local and global dependencies in node.js ?

31) What are streams in node.js ?  

32) Explain package.json file in node.js ?

33) What is the meaning of tilde and caret in package.json

34) How can we control versioning about packages in node.js ?

35) Difference between dependencies and dev dependencies ?

36) What is npm start ?

37) If I want to explain my own command with npm how can I do it ?

38) Explain logging in node.js ?

39) Name node.js framworks ?

40) What is express

41) How can we add the prefix in node.js apis?

42) Use of cookie-parser in node.js?

43) How to make APIs session less ?

Further Reading

Javascript Interview Questions

AngularJS Interview Questions

NPM : Node Package Manager

NPM is a node package manager for the JavaScript programming language.It is the world’s largest software registry. It consistes of a command line client also called NPM and also the default package manager for the javascript runtime environment Node.js. It also have online database of public packages called the NPM registry that hosts thousands of free packages to download and use. Moreover it consists of a command line client that interacts with a remote registry (packages in the registry are in CommonJS format and include a metadata file in JSON format).

Functionalities of NPM (Node Package Manager)

1) Command line utility to install Node.js packages
2) Provide dependency management and version management of Node.js packaged
3) provide online repositories for Node.js packages


The NPM program is installed on your computer when you install Node.js. To install node.js refer:

we can check it is installed or not by

$ which npm
$ npm --version

With Node Package Manager we can install packages in local and global mode. To install packages in local mode we need following command

npm install packagename

In local mode it installs the packages in node_modules folder in parent working directory.This location is owned by the current user.

To install packages in global mode

sudo npm install forever -g

This means you would have to use sudo to install packages globally, which could cause permission errors when resolving third-party dependencies, as well as being a security concern. Global packages are installed in {prefix}/lib/node_modules/ which is owned by root (where {prefix} is usually /usr/ or /usr/local)

To check the npm configuration we need

$ npm config list
; cli configs
user-agent = "npm/3.10.10 node/v6.10.3 linux x64"
; userconfig /home/sitepoint/.npmrc
prefix = "/home/sitepoint/.node_modules_global"
; node bin location = /usr/bin/nodejs
; cwd = /home/sitepoint
; HOME = /home/sitepoint
; "npm config ls -l" to show all defaults

This gives us information about our install. we can also get our current global location by

$ npm config get prefix

This is the prefix, we can also change the value of prefix also by using this command 
For this let first create a new folder in our home directory to save it

$ cd ~ && mkdir .global_node_modules
$ npm config set prefix=$HOME/.global_node_modules

To uninstall the packages we can use

npm uninstall packagename

To fetch the list of installed packages we can use

npm list

There are lot of commands for more info refer:



Node.js tutorial with basic Setup and Installation

What is Node.js 

Node.js is an open source cross-platform for developing server-side and networking applications. It provides runtime environment and uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. Moreover applications are written in JavaScript and can be run within the Node.js runtime on OS X, Microsoft Windows, Linux moreover its package ecosystem, npm is the largest ecosystem of open source libraries in the world.

Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Historically, JavaScript was used primarily for client-side scripting, in which scripts written in JavaScript are embedded in a web page’s HTML to be run client-side by a JavaScript engine in the user’s web browser. It enables JavaScript to be used for server-side scripting and runs scripts server-side to produce dynamic web page content before the page is sent to the user’s web browser.


Previously javascript code is in working on the client side(front end) only. But with the power of node.js, we can now play with it on the server side (backend) also to generate the dynamic content. Node.js is actually based on the event loop programming model. It repeatedly waits for events and then runs any event handlers subscribed to those events and the event loop runs in a single thread.

Events can be:

1) A new HTTP request coming our way
2) Timer wait is complete
3) Next chunk of data is ready to be written to the file

Due to this process, multiple requests are handled concurrently by a single Node.js process. As long as these event handlers are small and wait for yet more events themselves everything works out nicely and no Javascript code is ever executed in parallel, all of this runs in a single thread.

Why node is single threaded?

Node.Js was built with the intention of supporting asynchronous operations and the fact is that the asynchronous operations have better performance and scalability when they are single-threaded over multi-threaded. This is the reason the Node.Js is single threaded.

Features of Node.js

1) Server Side java Script
2) Versatile
3) High Reliability
4) Asynchronous
5) Single Threaded
6) Run Anywhere
7) No Buffering
8) Easy Integration with JS Stacks
9) Speedy Execution

Top websites powered by Node.js


For more info visit: 


For Linux follow the guide.

For Windows download the installer.

To check if nodejs is installed successfully, Open command prompt and type

node -v

What is NPM 

npm is a package manager for the JavaScript programming language. It is the default package manager for the JavaScript runtime environment Node.js. It consists of a command line client also called npm, and an online database of public packages called the npm registry.


Set up node.js application

Before create a node.js application we need to install express framework using npm command. ( Express is a lightweight and easy to use Node.js framework that helps to create and manage our apllication into MVC architecture.Express provides a robust set of features to develop mobile and web applications)


To install express run 

npm install express -g

The above command will install express globally on your machine. then type

npm install express-generator -g

It will install the express generator globally on your machine. After that to create the skeleton of node app just type 

express projectName

This will create the node.js skelton with name projectName, where project name is the name of your app skeleton. After that just go in the app structure and install the app dependencies by 

cd projectName
npm install

It will create the node modules folder where it install all the dependencies, after that just type npm start command to start the server and check it works or not. To check its proper working after run the start command just open any browser and type localhost:3000 to check the server is listening or not (3000 is the default port uses by it).

npm start

Now open any browser and hit localhost:3000

Forever : Never let you down

Forever is a node package used to run Node.js applications with monitoring. It keeps the server alive even when the server crash/stops. When the Node server is stopped due to some error or exception it will automatically start the server. It runs like a daemon on ubuntu Linux. So if the application dies forever brings it back. It will automatically start the server (Node.js application) when our linux server starts and ensure it stays running.

 Forever Setup

Forever can be installed using npm command. To install it globally

sudo npm -g install forever

The usage options for Forever expose four simple command line tasks: start, stop, stopall, list.

forever [start | stop | stopall | list] [options] script [script options]

Forever Options:

start    : Start script as a daemon
stop     : Stop the daemon script
stopall : Stop all running forever script
list      : List all running forever script

Now start server using forever command instead of node.

forever start server.js

To check server has started or not?

forever list
 [0] server.js [ 24597, 24596 ]

To kill that process we need simply

forever stop 0

More about its options read documentation available on Github and Npm website.

Nodemon : Code watcher and Auto-Reload

Nodemon run your server in watch mode, if there is any change it restart the application automatically. During development we need to restart the server manually for every change. To skip this hectic task of restarting server again and again, nodemon module is there. 

Features of Nodemon

  • Open source
  • Automatic apply changes with auto-restart the server
  • Detect default file extension to monitor
  • Requirable  in Node.js apps
  • Works with server applications or one-time run utilities


Nodemon can be installed using npm command.

We can install it globally by

npm install -g nodemon

It can also be installed locally

npm install nodemon --save-dev

Now run your server with nodemon command instead of node command.

nodemon your_app

For example if your app is server.js, you will run

nodemon server.js