ui developer interview questions

UI developers or Front end developers are people who build web pages using the technologies of HTML5, CSS3, JavaScript and Jquery based on the given visual design. The next-gen UI developers use CSS frameworks like Bootstrap, Materialize UI, Semantic UI and also other Javascript Frameworks like AngularJs Or ReactJs , with some supporting tools like Grunt, Gulp etc. that work using NodeJs. Today, we will talk about commonly asked UI Developer Interview Questions, for your better understanding we will go step by step, however if you want to skip the introduction and revision part & directly goto UI Developer Interview Questions.

Front End Development

Click here for a complete web development learning course

Introduction to HTML5

UI Developer Interview Questions & Answers

1. Question: What is doctype? Why do u need it?

Answer: doctype is an instruction to the browser to inform about the version of html document and how browser should render it.

It ensures how element should be displayed on the page by most of the browser. And it also makes browser’s life easier. otherwise, browser will guess and will go to quirks mode. Moreover, doctype is required to validate markup.

<!DOCTYPE html>
<meta charset="UTF-8">

2. Question: What is the use of data- attribute?

Answer: allow you to store extra information/ data in the DOM. u can write valid html with embedded private data. You can easily access data attribute by using javascript and hence a lot of libraries like knockout uses it.

<div id="myDiv" data-user="jsDude" data-list-size="5" data-maxage="180"></div>

3. Question: How can you generate public key in html?

Answer: html has a keygen element that facilitate generation of key and submission via a form.

<keygen challenge="challenge string" keytype="type" name="name">

4. Question: How can you change direction of html text?

Answer: use bdo (bidirectional override) element of html.

<!-- Switch text direction --> 
<p><bdo dir="rtl">This text will go right to left.</bdo></p>


This text will go right to left.

extra: rtl: right to left. and alternatively you can use, ltr: left to right.

5. Question: How can u highlight text in html?

Answer: use mark element.

<p>Some part of this paragraph is <mark>highlighted</mark> by using mark element.</p>

result:Some part of this paragraph is highlighted by using mark element.

6. Question: Can u apply css rule to a part of html document?

Answer: yes. by using “scopped” in the style tag.

ref MDN: style

7. Question: Does the following trigger http request at the time of page load?

 <img src="mypic.jpg" style="visibility: hidden" alt="My photo">

Answer: yes

<div style="display: none;"> <img src="mypic.jpg" alt="My photo"> </div>

Answer: yes

8. Question: Does style1.css have to be downloaded and parsed before style2.css can be fetched?

 <head> <link href="style1.css" rel="stylesheet"> <link href="style2.css" rel="stylesheet"> </head>

Answer: no

Question: Does style2.css have to be downloaded and parsed before Paragraph 1 is rendered on the page?

<head> <link href="style1.css" rel="stylesheet"> 
<body> <p>Paragraph 1</p> 
<p>Paragraph 2</p> <link href="style2.css" rel="stylesheet"> 

Answer: yes

9. Question: What are optional closing tag? and why would u use it?

Answer: p, li, td, tr, th, html, body, etc. you don’t have to provide end tag. Whenever browser hits a new tag it automatically ends the previous tag. However, you have to be careful to escape it.

reason: you can save some byte and reduce bytes needs to be downloaded in a html file.

<p>Some text
<p>Some more text
 <li>A list item
 <li>Another list item

the above html will be parsed as the following blocks :

<p>Some text</p> 
<p>Some more text</p> 
<li>A list item</li> 
<li>Another list item</li> 

10. Question: What is the difference between span and div?

Answer: div is a block element and span is inline element.

Extra: It is illegal to put block element inside inline element. div can have a p tag and a p tag can have a span. However, span can’t have a div or p tag inside.

11. Question: When should you use section, div or article?

<section>, group of content inside is related to a single theme, and should appear as an entry in an outline of the page. It’s a chunk of related content, like a subsection of a long article, a major part of the page (eg the news section on the homepage), or a page in a webapp’s tabbed interface. A section normally has a heading (title) and maybe a footer too.

<article>, represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.

<div>, on the other hand, does not convey any meaning, aside from any found in its class, lang and title attributes.

Extra: Authors are strongly encouraged to view the div element as an element of last resort, for when no other element is suitable. Use of more appropriate elements instead of the div element leads to better accessibility for readers and easier maintainability for authors.

12. Question: What are the difference between svg and canvas?


SVG is known as a retained mode graphics model persisting in an in-memory model. Analogous to HTML, SVG builds an object model of elements, attributes, and styles. When the <svg> element appears in an HTML5 document, it behaves like an inline block and is part of the HTML document tree.

Canvas is a bitmap with an immediate mode graphics application programming interface (API) for drawing on it. Canvas is a “fire and forget” model that renders its graphics directly to its bitmap and then subsequently has no sense of the shapes that were drawn; only the resulting bitmap stays around.

One way to think of these is that Canvas resembles the Windows GDI API, where you programmatically draw graphics to a window, and SVG resembles HTML markup with elements, styles, events, and DOM-based programmability. Canvas is procedural whereas SVG is declarative.

Read it in detail

13. Question: How to serve a page content in multiple languages?

Answer: CMS could be used to deliver content in different language with same structure and style.

14. Question: Difference between standard/ strict mode and quirks mode?

Answer: quirks mode in browser allows u to render page for as old browsers. This is for backward compatibility.

15. Question: What is semantic HTML?

Answer: Semantic HTML, or “semantically-correct HTML”, is HTML where the tags used to structure content are selected and applied appropriately to the meaning of the content.

for example, <b></b> (for bold), and <i></i> (for italic) should never be used, because they’re to do with formatting, not with the meaning or structure of the content. Instead, use the replacements <strong></strong> and <em></em> (meaning emphasis), which by default will turn text bold and italic (but don’t have to do so in all browsers), while adding meaning to the structure of the content.

16. Question: Why you would like to use semantic tag?

Answer: Search Engine Optimization, accessibility, repurposing, light code. Many visually impaired person rely on browser speech and semantic tag helps to interpret page content clearly. Search engine needs to understand page content to rank and semantic tag helps.

17. Question: What does “semantically correct” mean?

Answer:  It means that you’re calling something what it actually is. The classic example is that if something is a table, it should contain rows and columns of data. To use that for layout is semantically incorrect – you’re saying “this is a table” when it’s not. Another example: a list (<ul> or <ol>) should generally be used to group similar items (<li>). You could use a div for the group and a <span> for each item, and style each span to be on a separate line with a bullet point, and it might look the way you want. But “this is a list” conveys more information.

18. Question : How do you optimize a website’s assets?

Answer: File concatenation, file compression, CDN Hosting, offloading assets, re-organizing and refining code, etc. Have a few ready.

19. Question:  What is the difference between HTML elements and tags?

Answer: HTML elements communicate to the browser how to render text. When surrounded by angular brackets <> they form HTML tags. For the most part, tags come in pairs and surround text.

20. Question : What are three ways to reduce page load time?

Answer : Reduce image sizes, remove unnecessary widgets, HTTP compression, put CSS at the top and script references at the bottom or in external files, reduce lookups, minimize redirects, caching, etc.

21. Question : What kind of things must you be wary of when design or developing for multilingual sites?

Answer : setting the default language, using Unicode encoding, using the ‘lang’ attribute, being aware of standard font sizes and text direction, and language word length (may affect layout).

22. Question : How html5 is different from html4?

Answer: HTML5 is an upgraded version of html4.01 and introduced some new features such as Audio, Video, Canvas, Drag & Drop, Storage, Geo Location, Web Socket etc and also introduced some new html tags such as article, section, header, aside and nav etc which help to create the page layout faster. HTML 5 will handle the inaccurate syntax of the tags and it simplified the doctype and character set declaration. It also deprecated some html tags like center, font, strike, acronym, applet etc.

23. Question : What are the new form attributes in HTML5 ?

Answer : Placeholder, novalidate, autocomplete, required , autofocus, pattern, list, multiple, formnovalidate, etc

24. Question : How browsers detect the html version of a webpage?

Answer : We must declare the doctype at the top of the page, it is an instruction to the web browser about what version of HTML the page is written in.

25. Question : What is SVG?

Answer : SVG stands for Scalable Vector Graphics, It is an XML based two-dimensional vector graphics image format.

26. Question : What is character encoding in HTML ?

Answer : Character encoding is a rule for how to interpret raw zeroes and ones into real characters. There are two main character encoding representations used in html documnets such as UTF-8, and ISO-8859-1. The default character set for HTML5 is UTF-8. The following syntax is used to set the character encoding in an html document <meta charset="UTF-8">

27. Question : What is HTML Entities ?

Answer : HTML Entities are some special words which is used to replace the reserved characters or some other characters that are not present on your keyboard can also be replaced by entities in your HTML, For example if you need to display ( ‘Less than’ symbol ) In your html document, You can use &lt; Entity

28. Question : What is meant by a Responsive Web Site ?

Answer : It will looks good in all screen resolutions device type. We can utilize css media quries to re-arrange the with of an element also we can hide or display any elements in a web page. Bootstrap is a widely using css framework to make responsive web pages quikly

29. Question : List out some HTML5 tags

Answer : header, footer, main, nav, section, article, aside etc..

30. Question : What is the use of HTML5 Canvas element ?

Answer : It is used to draw graphics on a web page by the help of javascript.

31. Question : What is the use of ‘placeholder’ attribute in HTML5?

Answer : It is used to display some text with in a textbox or textarea and the text will disappear when user start typing in that box

32. Question : Explain about HTML5 local storage ?

Answer : There are two ways to store data in HTML as objects locally :

localStorage – store data  across session access
sessionStorage – storing data for current session only


Data will be stored in key/value pair format.



sessionStorage.companyname = “EduPro Learning”;

33. Question : Explain CSS media queries ?

Answer : CSS media queries are used to develop responsive templates for different layout of screen, print, mobile , tablet or any other resolutions

CSS media queries can be added in 3 ways as like CSS style sheet :

  1. Internal stylesheet :
    <style type=”text/css”>
    @media only screen and (max-width: 600px){
    /* rules apply to the device resolution is 480px or less  */
  2. Imported stylesheet :
       @import “tablet.css”   (min-width: 800px) and (max-width: 1200px);
  3. External stylesheet:
     <link rel=”stylesheet” type=”text/css” href=”desktop.css” media=”screen and (min-width: 1200px), print and (min-resolution: 300dpi)” />

34. Question : Explain css inheritance ?

Answer : Inheritance propagates property values from parent elements to their children. The inherited value of a property on an element is the computed value of the property on the element’s parent element. For the root element, which has no parent element, the inherited value is the initial value of the property.

A property can also be explicitly inherited by using the inherit keyword in property.

CSS inheritance example:
class inheritance for an HTML tag :

 <div class=”firstClass secondClass thirdClass fourthClass ” > </div >

CSS property inheritance from parent :

p {
color: #000;
p a:link {
color: inherit;

and using LESS method for inheritance example:
//through variable
@color: #123456;
#emp {
color: @color;
div {
color: @color;

//through class name calling [MIXINS]

.rounded-corners (@radius: 2px) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
-ms-border-radius: @radius;
-o-border-radius: @radius;
border-radius: @radius;

#navtable {

#maintable {

35. Question: What is javascript inheritance ?

Answer : In simple terms, inheritance is the concept of one thing gaining the properties or behaviours of something else.
Inherited children inherit their parent’s behaviour To say A inherits from B, is saying that A is a type of B.
In JavaScript You must use a special object called prototype.

function Animal() {}; // This is the Animal *Type*
Animal.prototype.eat = function () {
alert(“All animals can eat!”);

function Bird() {}; // Declaring a Bird *Type*
Bird.prototype = new Animal(); // Birds inherit from Animal
Bird.prototype.fly = function() {
alert(“Birds are special, they can fly!”);

The effect of this is that any Birds you create (called an instance of Bird) all have the properties of Animals
var aBird = new Bird(); // Create an instance of the Bird Type
aBird.eat(); // It should alert, so the inheritance worked
aBird.fly(); // Important part of inheritance, Bird is also different to Animal

var anAnimal = new Animal(); // Let’s check an instance of Animal now
anAnimal.eat(); // Alerts, no problem here
anAnimal.fly(); // Error will occur, since only Birds have fly() in its prototype

36. Question : Explain javascript associative array ?

Answer : Associative arrays are where we can associate a key string with a value string
JavaScript objects are also associative arrays.
i.e the property  emp.Name can also be read by calling emp[‘Name’]
We can access each property by entering the name of the property as a string into the array
it refers to accessing the DOM elements of HTML also [as object or associative array]

37. Question : Explain JS Namespace ?

Answer : Namespacing is a technique employed to avoid collisions with other objects or variables in the global namespace
and also helps to organize blocks of functionality into easily manageable groups that can be uniquely identified.

JavaScript doesn’t  builtin support of namespacing but using objects and closures we can achieve a similar effect.
javascript Namespacing patterns :
1)    Single global variables :

var myApplication =  (function(){

2)    Object literal notation :

var myApplication = {
getInfo:function(){ /**/ },
// we can also populate our object literal to support
// further object literal namespaces containing anything
// really:
models : {},
views : {
pages : {}
collections : {}

3)    Nested namespacing :

var myApp =  myApp || {};
// perform a similar existence check when defining nested
// children
myApp.routers = myApp.routers || {};
myApp.model = myApp.model || {};
myApp.model.special = myApp.model.special || {};
// nested namespaces can be as complex as required

4)    Immediately-invoked Function Expressions :

// an (anonymous) immediately-invoked function expression
(function(){ /*…*/})();
// a named immediately-invoked function expression
(function foobar(){ /*..*/}());
// this is technically a self-executing function which is quite different
function foobar(){ foobar(); }

5)   Namespace injection :

// define a namespace we can use later
var ns = ns || {}, ns2 = ns2 || {};
// the module/namespace creator
var creator = function(val){
var val = val || 0;
this.next = function(){
return val++

this.reset = function(){
val = 0;

// ns.next, ns.reset now exist
creator.call(ns2, 5000);
// ns2 contains the same methods
// but has an overridden value for val
// of 5000

38. Question : Explain Jquery live and bind methods ?

Answer : .bind() attacheds events to elements that exist or match the selector at the time the call is made.
Any elements created afterwards or that match going forward because the class was changed, will not fire the bound event.

$(‘img’).bind(‘click’, function(){…});

.live() works for existing and future matching elements.
Before jQuery 1.4 this was limited to the following events:
click, dblclick mousedown, mouseup, mousemove, mouseover, mouseout, keydown, keypress, keyup
$(‘img’).live(‘click’, function(){…});

39. Question : What is bootstrap ?

Answer : Bootstrap is an open-source Javascript framework developed by the team at Twitter.
It is a combination of HTML, CSS, and Javascript code designed to help build user interface components. Bootstrap is Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development. Bootstrap was also programmed to support both HTML5 and CSS3 Bootstrap is a CSS and Javascript framework that is used within your HTML. Bootstrap provides more advanced functionality to your web site.

40. Question : Explain types of web services ?

Answer : There are two types of web service….1. SOAP [Simple Object Access Protocol] Webservice and 2. RESTful [REpresentational State Transfer] Webservice.
SOAP is a messaging protocol , REST is a design philosophy , not a protocol.

you define your interface in a .wsdl file, which describes exactly which input parameters are expected and how the return values will look like
there are tools to generate the .wsdl files out of java class hirarchies. JAXB for example
there are also tools to generate java objects/classes as part of eclipse for example (don’t know the name in the moment).
SOAP is very strict. Every request is validatet against the wsdl before processing.

A good but not so easy to start with framework for SOAP WS is Apache CXF

REST (no hands on experience up to now, feel free to correct and improve 😉 ):

a way to access a webserver or web application to retrieve data from or send to it.
it’s only negotiated, how it is accessed.
common is something like this http://server.domain.com/app/type/id=456 to retrieve object of type type with id=456

very intuitive, but no automatic validation of requests.

The main advantages of REST web services are:

Lightweight – not a lot of extra xml markup
Human Readable Results
Easy to build – no toolkits required

SOAP also has some advantages:

Easy to consume – sometimes
Rigid – type checking, adheres to a contract
Development tools

More UI Developer Interview Questions

General Questions:

  • What did you learn yesterday/this week?
  • What excites or interests you about coding?
  • What is a recent technical challenge you experienced and how did you solve it?
  • What UI, Security, Performance, SEO, Maintainability or Technology considerations do you make while building a web application or site?
  • Talk about your preferred development environment.
  • Which version control systems are you familiar with?
  • Can you describe your workflow when you create a web page?
  • If you have 5 different stylesheets, how would you best integrate them into the site?
  • Can you describe the difference between progressive enhancement and graceful degradation?
  • How would you optimize a website’s assets/resources?
  • How many resources will a browser download from a given domain at a time?
    • What are the exceptions?
  • Name 3 ways to decrease page load (perceived or actual load time).
  • If you jumped on a project and they used tabs and you used spaces, what would you do?
  • Describe how you would create a simple slideshow page.
  • If you could master one technology this year, what would it be?
  • Explain the importance of standards and standards bodies.
  • What is Flash of Unstyled Content? How do you avoid FOUC?
  • Explain what ARIA and screenreaders are, and how to make a website accessible.
  • Explain some of the pros and cons for CSS animations versus JavaScript animations.

HTML Questions:

  • What does a doctype do?
  • What’s the difference between standards mode and quirks mode?
  • What’s the difference between HTML and XHTML?
  • Are there any problems with serving pages as application/xhtml+xml?
  • How do you serve a page with content in multiple languages?
  • What kind of things must you be wary of when design or developing for multilingual sites?
  • What are data- attributes good for?
  • Consider HTML5 as an open web platform. What are the building blocks of HTML5?
  • Describe the difference between a cookiesessionStorage and localStorage.
  • Describe the difference between <script><script async> and <script defer>.
  • Why is it generally a good idea to position CSS <link>s between <head></head> and JS <script>s just before </body>? Do you know any exceptions?
  • What is progressive rendering?
  • Have you used different HTML templating languages before?

CSS Questions:

  • What is the difference between classes and ID’s in CSS?
  • What’s the difference between “resetting” and “normalizing” CSS? Which would you choose, and why?
  • Describe Floats and how they work.
  • Describe z-index and how stacking context is formed.
  • Describe BFC(Block Formatting Context) and how it works.
  • What are the various clearing techniques and which is appropriate for what context?
  • Explain CSS sprites, and how you would implement them on a page or site.
  • What are your favourite image replacement techniques and which do you use when?
  • How would you approach fixing browser-specific styling issues?
  • How do you serve your pages for feature-constrained browsers?
    • What techniques/processes do you use?
  • What are the different ways to visually hide content (and make it available only for screen readers)?
  • Have you ever used a grid system, and if so, what do you prefer?
  • Have you used or implemented media queries or mobile specific layouts/CSS?
  • Are you familiar with styling SVG?
  • How do you optimize your webpages for print?
  • What are some of the “gotchas” for writing efficient CSS?
  • What are the advantages/disadvantages of using CSS preprocessors?
    • Describe what you like and dislike about the CSS preprocessors you have used.
  • How would you implement a web design comp that uses non-standard fonts?
  • Explain how a browser determines what elements match a CSS selector.
  • Describe pseudo-elements and discuss what they are used for.
  • Explain your understanding of the box model and how you would tell the browser in CSS to render your layout in different box models.
  • What does * { box-sizing: border-box; } do? What are its advantages?
  • List as many values for the display property that you can remember.
  • What’s the difference between inline and inline-block?
  • What’s the difference between a relative, fixed, absolute and statically positioned element?
  • The ‘C’ in CSS stands for Cascading. How is priority determined in assigning styles (a few examples)? How can you use this system to your advantage?
  • What existing CSS frameworks have you used locally, or in production? How would you change/improve them?
  • Have you played around with the new CSS Flexbox or Grid specs?
  • How is responsive design different from adaptive design?
  • Have you ever worked with retina graphics? If so, when and what techniques did you use?
  • Is there any reason you’d want to use translate() instead of absolute positioning, or vice-versa? And why?

JS Questions:

  • Explain event delegation
  • Explain how this works in JavaScript
  • Explain how prototypal inheritance works
  • What do you think of AMD vs CommonJS?
  • Explain why the following doesn’t work as an IIFE: function foo(){ }();.
    • What needs to be changed to properly make it an IIFE?
  • What’s the difference between a variable that is: nullundefined or undeclared?
    • How would you go about checking for any of these states?
  • What is a closure, and how/why would you use one?
  • What’s a typical use case for anonymous functions?
  • How do you organize your code? (module pattern, classical inheritance?)
  • What’s the difference between host objects and native objects?
  • Difference between: function Person(){}var person = Person(), and var person = new Person()?
  • What’s the difference between .call and .apply?
  • Explain Function.prototype.bind.
  • When would you use document.write()?
  • What’s the difference between feature detection, feature inference, and using the UA string?
  • Explain AJAX in as much detail as possible.
  • Explain how JSONP works (and how it’s not really AJAX).
  • Have you ever used JavaScript templating?
    • If so, what libraries have you used?
  • Explain “hosting”
  • Describe event bubbling.
  • What’s the difference between an “attribute” and a “property”?
  • Why is extending built-in JavaScript objects not a good idea?
  • Difference between document load event and document ready event?
  • What is the difference between == and ===?
  • Explain the same-origin policy with regards to JavaScript.
  • Make this work:
duplicate([1,2,3,4,5]); // [1,2,3,4,5,1,2,3,4,5]
  • Why is it called a Ternary expression, what does the word “Ternary” indicate?
  • What is "use strict";? what are the advantages and disadvantages to using it?
  • Create a for loop that iterates up to 100 while outputting “fizz” at multiples of 3"buzz" at multiples of 5 and “fizzbuzz” at multiples of 3 and 5
  • Why is it, in general, a good idea to leave the global scope of a website as-is and never touch it?
  • Why would you use something like the load event? Does this event have disadvantages? Do you know any alternatives, and why would you use those?
  • Explain what a single page app is and how to make one SEO-friendly.
  • What is the extent of your experience with Promises and/or their polyfills?
  • What are the pros and cons of using Promises instead of callbacks?
  • What are some of the advantages/disadvantages of writing JavaScript code in a language that compiles to JavaScript?

Testing Questions:

  • What are some advantages/disadvantages to testing your code?
  • What tools would you use to test your code’s functionality?
  • What is the difference between a unit test and a functional/integration test?
  • What is the purpose of a code style linting tool?

Performance Questions:

  • What tools would you use to find a performance bug in your code?
  • What are some ways you may improve your website’s scrolling performance?
  • Explain the difference between layout, painting and compositing.

Network Questions:

  • Traditionally, why has it been better to serve site assets from multiple domains?
  • Do your best to describe the process from the time you type in a website’s URL to it finishing loading on your screen.
  • What are the differences between Long-Polling, Websockets and Server-Sent Events?
  • Explain the following request and response headers:
    • Diff. between Expires, Date, Age and If-Modified-…
    • Do Not Track
    • Cache-Control
    • Transfer-Encoding
    • ETag
    • X-Frame-Options
  • What are HTTP actions? List all HTTP actions that you know, and explain them.

Fun Questions:

  • What’s a cool project that you’ve recently worked on?
  • What are some things you like about the developer tools you use?
  • Do you have any pet projects? What kind?
  • What’s your favorite feature of Internet Explorer?

All Set For The Interview

Well folks, that’s not all but still it’s an exhaustive list and if you are reading this it means that you have prepared yourself comprehensively for the interview.

In case, I have missed any then let me know in the comments box below.

Best of luck!

Please note that : In case you are seeking to learn web development, click here to start learning.

len in python, learn python, learn python the hard way pdf, inheritance in python

Inheritance in Python is the property of classes to inherit from other classes. A class can inherit objects, attributes and methods from another class – called the superclass. The class which inherits from a superclass is called a subclass or child class. While inheritance is the property of Object orient programming but there is a support for multiple inheritance in Python as well.

Inheritance In Python

Click here for a complete step by step Python learning course.

Syntax & Example

class BaseClass:
  Body of base class
class DerivedClass(BaseClass):
  Body of derived class

Let’s take a simple example – we create a Person class with the two attributes “firstname” and “lastname” with one method – Name method which returns the values, but we don’t have an attribute name. This method creates an output by creating it from more than one private attribute. Name returns the concatenation of the first name and last name of the person.

inheritance in python
Fig. – Inheritance in Python

Now we need another sub class, which inherits from Person. Just like us, we know employees in companies are Persons  and if we create an Employee class without inheriting from Person, we need to define all the attributes and methods in the Employee class again. This means we would create a design and a data redundancy. To avoid such, we can make Employee to inherit attributes from Person.

class Person:

    def __init__(self, first, last):
        self.firstname = first
        self.lastname = last

    def Name(self):
        return self.firstname + " " + self.lastname

class Employee(Person):

    def __init__(self, first, last, staffnum):
        Person.__init__(self,first, last)
        self.staffnumber = staffnum

    def GetEmployee(self):
        return self.Name() + ", " +  self.staffnumber

x = Person("Jon", "Snow")
y = Employee("Cersei", "Lannister", "266")


Output :

Jon Snow
Cersei Lannister, 266

The __init__ method of the Employee class explicitly invokes the __init__method of the Person class. Instead we can also use super – super().__init__(first, last) is automatically replaced by a call to the superclasses method, in this case __init__:

    def __init__(self, first, last, staffnum):
        super().__init__(first, last)
        self.staffnumber = staffnum

Only Python 3 supports super()) without arguments for lesser versions of Python use “super(Employee, self).__init__(first, last, age)”

Overloading and Overriding

Instead of using the methods “Name” and “GetEmployee” in our previous example, it might have been better to put this functionality into the “__str__” method. In doing so, we gain a lot, especially a leaner design. We have a string casting for our classes and we can simply print out instances. Let’s start with a __str__ method in Person:

class Person:
    def __init__(self, first, last):
        self.firstname = first
        self.lastname = last

    def __str__(self):
        return self.firstname + " " + self.lastname

class Employee(Person):

    def __init__(self, first, last, staffnum):
        super().__init__(first, last)
        self.staffnumber = staffnum

x = Person("Jon", "Snow")
y = Employee("Cersei", "Lannister", "266")



Jon Snow
Cersei Lannister

We see that if we print an instance of the Employee class, the __str__ method of Person is used. This is due to inheritance. The only problem we have now is the fact that the output of “print(y)” is not the same as the “print(y.GetEmployee())”. This means that our Employee class needs its own __str__ method. We could write it like this:

    def __str__(self):
        return self.firstname + " " + self.lastname + ", " +  self.staffnumber

But it is a lot better to use the __str__ method of Person inside of the new definition. This way, we can make sure that the output of the Employee __str__method will automatically change, if the __str__ method from the superclass Person changes. We could for example add a new attribute age in Person:

class Person:

    def __init__(self, first, last, age):
        self.firstname = first
        self.lastname = last
        self.age = age

    def __str__(self):
        return self.firstname + " " + self.lastname + ", " + str(self.age)

class Employee(Person):

    def __init__(self, first, last, age, staffnum):
        super().__init__(first, last, age)
        self.staffnumber = staffnum

    def __str__(self):
        return super().__str__() + ", " +  self.staffnumber

x = Person("Jon", "Snow", 24)
y = Employee("Cersei", "Lannister", 42, "266")


We have overridden the method __str__ from Person in Employee. By the way, we have overridden __init__ also. Method overriding is an object-oriented programming feature that allows a subclass to provide a different implementation of a method that is already defined by its superclass or by one of its superclasses. The implementation in the subclass overrides the implementation of the superclass by providing a method with the same name, same parameters or signature, and same return type as the method of the parent class.

Overwriting is a term wrongly used for overriding!

In the context of object-oriented programming, you might have heard about “overloading” as well. Overloading is the ability to define the same method, with the same name but with a different number of arguments and types. It’s the ability of one function to perform different tasks, depending on the number of parameters or the types of the parameters.

Let’s look first at the case, in which we have the same number of parameters but different types for the parameters. When we define a function in Python, we don’t have to and we can’t declare the types of the parameters. So if we define the function “successor” in the following example, we implicitly define a family of function, i.e. a function, which can work on integer values, one which can cope with float values and so. Of course, there are types which will lead to an error if used:

>>> def successor(number):
...     return number + 1
>>> successor(4)
>>> successor(3.5)
>>> successor([1,2,3])
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 2, in successor
TypeError: can only concatenate list (not "int") to list

Having a function with a different number of parameters is another way of function overloading, however this does not work in Python as the error stated in the example above.

If we need such a behaviour, we can simulate it with default parameters:

def f(n, m=None):
    if m:
        return n + m +42
        return n + 42

The * operator can be used as a more general approach for a family of functions with 1, 2, 3, or even more parameters:

def f(*x):
    if len(x) == 1:
        return x[0] + 42
        return x[0] + x[1] + 42

Multiple Inheritance in Python

Multiple Inheritance is inheriting the property of multiple classes into one. In case there are two classes, say A and B, and one needs to create a new class which can inherit the properties of both A and B

Multiple Inheritance in Python
Fig – Multiple Inheritance in Python
class A:
  	# properties of class A

class B:
  	# properties of class B

class C(A, B):
  	# class C inheriting property of both class A and B
  	# add more properties to class C

As you see, instead of mentioning one class, we simply mentioned another class inside the brackets. And FYI, you can add as many classes you like inside it. Thus, it should actually be like –


class A (A1, A2, A3, ...):
  	# class A inheriting the properties of A1, A2, A3, etc.
  	# Add more properties which A have on its own.

Multilevel Inheritance in Python

In multilevel inheritance, you inherit the classes at multi-levels. We have three classes A, B and C, where A is the super class, B is its sub class and C is the sub class of B.

Multilevel Inheritance in Python
Fig – Multilevel Inheritance in Python
class A:
  	# properties of class A

class B(A):
  	# class B inheriting property of class A
  	# add more properties of class B

class C(B):
  	# class C inheriting property of class B
  	# thus, class C also inheriting properties of class A
  	# add more properties of class C
php oops interview questions

PHP [“PHP: Hypertext Preprocessor”] is the most widely used open source server scripting language, and is a powerful tool for making dynamic and interactive web pages. There are lots of vacancies in the market pertaining to the level of expertise you have in PHP. Today we will talk about most common and frequently asked php oops interview questions. In order to prepare you for the task we will go step by step, so that your understanding is more robust and deep, however if you want you can directly skip to the php oops interview questions here.

Why PHP?

  • PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
  • PHP is compatible with almost all servers used today (Apache, IIS, etc.)
  • PHP supports a wide range of databases
  • PHP is free. Download it from the official PHP resource: www.php.net
  • PHP is easy to learn and runs efficiently on the server side

What is a PHP File?

  • PHP files can contain text, HTML, CSS, JavaScript, and PHP code
  • PHP code are executed on the server, and the result is returned to the browser as plain HTML
  • PHP files have extension “.php”

What Can PHP Do?

  • PHP can generate dynamic page content
  • PHP can create, open, read, write, delete, and close files on the server
  • PHP can collect form data
  • PHP can send and receive cookies
  • PHP can add, delete, modify data in your database
  • PHP can be used to control user-access
  • PHP can encrypt data

With PHP you are not limited to output HTML. You can output images, PDF files, and even Flash movies. You can also output any text, such as XHTML and XML.

Let’s quickly revisit PHP via a crash course

What is OOP?


PHP OOPS Interview Questions & Answers

1) What is object oriented programming language?
It is a programming methodology based on objects, instead of just functions and procedures. These objects are organized into classes, which allow individual objects to be group together. OOP languages allow concepts such as modularity, encapsulation, polymorphism and inheritance. Objects are the most important part of object oriented language. Program revolves around its data (object)& set well define interface to that data. OOPs properties including DataHiding, Inheritence, Data Absraction,Data Encapsulation and many more.

PHP OOPS Interview Questions

2) What is object in object oriented programming?
An “object” in an OOP language refers to a specific type, or “instance,” of a class. Each object has a structure similar to other objects in the class, but can be assigned individual characteristics. An object can also call functions, or methods, specific to that object. For example, the source code of a video game may include a class that defines the structure of characters in the game. Individual characters may be defined as objects, which allows them to have different appearances, skills, and abilities. They may also perform different tasks in the game, which are run using each object’s specific methods.

PHP OOPS Interview Questions

3) Name other languages which also have object oriented language and characteristics?
Some of the languages which have object oriented languages present in them are ABAP, ECMA Script, C++, Perl, LISP, C#, Tcl, VB, Ruby, Python, PHP, etc. Popularity of these languages has increased considerably as they can solve complex problems with ease.

4) What is UML?
UML or unified modeling language is regarded to implement complete specifications and features of object oriented language. Abstract design can be implemented in object oriented programming languages. It lacks implementation of polymorphism on message arguments which is a OOPs feature.

PHP OOPS Interview Questions

5) Explain about message passing in object oriented programming?
Message passing is a method by which an object sends data to another object or requests other object to invoke method. This is also known as interfacing. It acts like a messenger from one object to other object to convey specific instructions.

6) Explain Java and its relation to Object oriented programming?
Java is widely used and its share is increasing considerably which is partly due to its close resemblance to object oriented languages such as C++. Code written in Java can be transported to many different platforms without changing it. It implements virtual machine.

7) What are the common problems faced by the developers in OOP?

a) Object oriented uses design patterns which can be referred to as anything in general.
b) Repeatable solution to a problem can cause concern and disagreements and it is one of the major problems in software design.

8 ) What are the advantages of object oriented programming?
a) A clear modular structure can be obtained which can be used as a prototype and it will not reveal the mechanism behind the design. It does have a clear interface.
b) Ease of maintenance and modification to the existing objects can be done with ease.
c) A good framework is provided which facilitates in creating rich GUI applications.

9 ) Explain Inheritance in OOPS?
Inheritance revolves around the concept of inheriting knowledge and class attributes from the parent class. In general sense a sub class tries to acquire characteristics from a parent class and they can also have their own characteristics. Inheritance forms an important concept in object oriented programming. Objects in one class can acquire properties of the objects in other classes by way of inheritance. Reusability which is a major factor is provided in object oriented programming which adds features to a class without modifying it. New class can be obtained from a class which is already present.

PHP OOPS Interview Questions

10) What is the relationship between object oriented programming and databases?
Object oriented programming and relational database programming are almost similar in software engineering. RDBMS will not store objects directly and that’s where object oriented programming comes into play. Object relational mapping is one such solution.

11) What is a class in OOP?
In Object oriented programming usage of class often occurs. A class defines the characteristics of an object and its behaviors. This defines the nature and functioning of a specified object to which it is assigned. Code for a class should be encapsulated.

PHP OOPS Interview Questions

12) Explain the use of encapsulation?
Encapsulation specifies the different classes which can use the members of an object. The main goal of encapsulation is to provide an interface to clients which decrease the dependency on those features and parts which are likely to change in future. This facilitates easy changes to the code and features.

13) What is abstraction?
Abstraction can also be achieved through composition. It solves a complex problem by defining only those classes which are relevant to the problem and not involving the whole complex code into play.

14) What is a method?
A method will affect only a particular object to which it is specified. Methods are verbs meaning they define actions which a particular object will perform. It also defines various other characteristics of a particular object.

15) Name the different creational patterns in OO design?
a) Factory pattern
b) Single ton pattern
c) Prototype pattern
d) Abstract factory pattern
e) Builder pattern

16) Explain realistic modeling?
As we live in a world of objects, it logically follows that the object oriented approach models the real world accurately. The object oriented approach allows you to identify entities as objects having attributes and behavior.

17) What is analysis phase?
The anlaysis or the object oriented analysis phase considers the system as a solution to a problem in its environment or domain. Developer concentrates on obtaining as much information as possible about the problem. Critical requirements needs to be identified.

18 ) Explain the rationale behind Object Oriented concept?

Object oriented concepts form the base of all modern programming languages. Understanding the basic concepts of object-orientation helps a developer to use various modern day programming languages, more effectively.

19) Explain the implementation phase with respect to OOP?
The design phase is followed by OOP, which is the implementation phase. OOP provides specifications for writing programs in a programming language. During the implementation phase, programming is done as per the requirements gathered during the analysis and design phases.

20) What is the Design Phase?
In the design phase, the developers of the system document their understanding of the system. Design generates the blue print of the system that is to be implemented. The first step in creating an object oriented design is the identification of classes and their relationships.

21) What is a class?
Class describes the nature of a particular thing. Structure and modularity is provided by a Class in object oriented programming environment. Characteristics of the class should be understandable by an ordinary non programmer and it should also convey the meaning of the problem statement to him. Class acts like a blue print.

22) What is an instance in object oriented programming?
Every class and an object have an instance. Instance of a particular object is created at runtime. Values defined for a particular object define its State. Instance of an object explains the relation ship between different elements.

23) Explain multiple inheritance?
Inheritance involves inheriting characteristics from its parents also they can have their own characteristics. In multiple inheritance a class can have characteristics from multiple parents or classes. A sub class can have characteristics from multiple parents and still can have its own characteristics.

PHP OOPS Interview Questions

24) What is encapsulation?
Encapsulation passes the message without revealing the exact functional details of the class. It allows only the relevant information to the user without revealing the functional mechanism through which a particular class had functioned.

25)  Explain the mechanism of composition?
Composition helps to simplify a complex problem into an easier problem. It makes different classes and objects to interact with each other thus making the problem to be solved automatically. It interacts with the problem by making different classes and objects to send a message to each other.

26) What is polymorphism?
Polymorphism helps a sub class to behave like a parent class. When an object belonging to different data types respond to methods which have a same name, the only condition being that those methods should perform different function.

27) Explain overriding polymorphism?
Overriding polymorphism is known to occur when a data type can perform different functions. For example an addition operator can perform different functions such as addition, float addition etc. Overriding polymorphism is generally used in complex projects where the use of a parameter is more.

28) Explain object oriented databases?
Object oriented databases are very popular such as relational database management systems. Object oriented databases systems use specific structure through which they extract data and they combine the data for a specific output. These DBMS use object oriented languages to make the process easier.

29) What is parametric polymorphism?
Parametric polymorphism is supported by many object oriented languages and they are very important for object oriented techniques. In parametric polymorphism code is written without any specification for the type of data present. Hence it can be used any number of times.

30) What are all the languages which support OOP?
There are several programming languages which are implementing OOP because of its close proximity to solve real life problems. Languages such as Python, Ruby, Ruby on rails, Perl, PHP, Coldfusion, etc use OOP. Still many languages prefer to use DOM based languages due to the ease in coding.

Should you have more php oops interview questions then let us know in the comments.

len in python, learn python, learn python the hard way pdf, inheritance in python

Python is a high-level, interpreted & object-oriented programming language created by Guido van Rossum during 1985- 1990. Python source code is open and available under the GNU General Public License (GPL). Today Python is being intensively for all sorts of development, courtesy its flexibility and libraries it can be used to mine data,  web development, or machine learning etc. As the demand is rising so is the number of people who want to learn Python rising as well. Being open source, there are lot of  online resources to learn Python, however we are listing here top books in pdf format that you can download them to learn Python.

Download Learn Python The Hard Way PDF

Download Learn Python The Hard Way 1.0 PDF

Download Python TutorialsPoint PDF

Alternatively you can start learning Python for free, in an easy step by step learning from here – Python For Beginners.

Please note that : The content-books belong to their respective owners and we are not responsible for their content.

Why you should learn Python?

Some of Python’s notable features:

  • Uses an elegant syntax, making the programs you write easier to read.
  • Is an easy-to-use language that makes it simple to get your program working. This makes Python ideal for prototype development and other ad-hoc programming tasks, without compromising maintainability.
  • Comes with a large standard library that supports many common programming tasks such as connecting to web servers, searching text with regular expressions, reading and modifying files.
  • Python’s interactive mode makes it easy to test short snippets of code. There’s also a bundled development environment called IDLE.
  • Is easily extended by adding new modules implemented in a compiled language such as C or C++.
  • Can also be embedded into an application to provide a programmable interface.
  • Runs anywhere, including Mac OS XWindowsLinux, and Unix, with unofficial builds also available for Android and iOS.

  • Is free software in two senses. It doesn’t cost anything to download or use Python, or to include it in your application. Python can also be freely modified and re-distributed, because while the language is copyrighted it’s available under an open source license.

Some programming-language features of Python are:

  • A variety of basic data types are available: numbers (floating point, complex, and unlimited-length long integers), strings (both ASCII and Unicode), lists, and dictionaries.
  • Python supports object-oriented programming with classes and multiple inheritance.
  • Code can be grouped into modules and packages.
  • The language supports raising and catching exceptions, resulting in cleaner error handling.
  • Data types are strongly and dynamically typed. Mixing incompatible types (e.g. attempting to add a string and a number) causes an exception to be raised, so errors are caught sooner.
  • Python contains advanced programming features such as generators and list comprehensions.
  • Python’s automatic memory management frees you from having to manually allocate and free memory in your code.

Source : Python.org

len in python, learn python, learn python the hard way pdf, inheritance in python

The len in python is a built-in function in Python that returns the number of elements in the list. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).

Syntax for len in python


Example for len in python

list1, list2 = [1234, 'abc', 'sun'], [786, 'xyz']
print "list1 length : ", len(list1)
print "list2 length : ", len(list2)


list1 length :  3
list2 length :  2

len is implemented with __len__, from the data model docs:


Called to implement the built-in function len(). Should return the length of the object, an integer >= 0. Also, an object that doesn’t define a __nonzero__() [in Python 2 or __bool__()in Python 3] method and whose __len__() method returns zero is considered to be false in a Boolean context.
And we can also see that __len__ is a method of lists:

>>> 3

How to use len in Python?

How to check whether a list is empty or not?

Only write

if list1:

and do not use

if len(list1)

Know more about Python builtin functions & lists.

Click here to start learning Python for beginners completely free and easy step by step learning.

career in content writing

The Internet is the Panacea of the modern world. From research to shopping, to news internet has the solution to all our problems. As a business, if you want to stay competitive in your online marketing then you need robust content writing.So today we talk about content writing, the future and building a career in content writing.

What is Content Writing?

career in content writing

Content writing is basically creating web-friendly content for a client or company, or for personal use. The main objective of content writing is attracting visitors to your website with thousands of articles grabbing their attention.

Career in content writing

career in content writing

A content writer creates content suitable for the internet. They also provide promotional and attractive content for the social media. The content should have proper S.E.O.(search engine optimization) which you can start learning here.

Click to start learning SEO

From creation to distribution, new technology is enabling marketers to forge new paths and engage consumers. And smart brands are trying to better understand how their audience consumes content.

Understanding Content Writing

Technologies that will Shape the Future of Content Writing

The advent of Virtual Reality – Virtual reality (VR) is already prominent in real estate, entertainment, and sports. It only makes sense that businesses will take advantage of this additional channel to incorporate immersive content.

career in content writing

Use of Artificial Intelligence to curate things-In an era of content overload, AI makes content production more predictive, personalized and productive. Open Influence is just one company that’s leveraging AI to tag photo content and identify which influencers are generating the most engagement across various product categories.



career in content writing

Native Advertising-Native advertising will play a crucial role in the next generation of content strategy. Megan James, a content strategist at MGID, believes consumers will see  narrower divide between content marketing and native advertising.



career in content writing

The growth of Live Streaming-Viewers watch live videos eight times longer than on-demand content. No wonder, then, that live video is becoming the core of all online content.



Skills required to build a career in content writing

Develop different writing styles

The reason is that each form of writing has its own style. News is delivered AP style, in short, informational paragraphs with the meat of the story at the top. Blogging is personable, friendly and often opinionated. Ad copy is short and persuasive. White papers are long; they describe a problem and provide the solution. But, regardless, each and every category is content, and each style writers master makes them more valuable and in demand.

Don’t pick random subjects

“Ideation” is a marketing industry buzzword that describes the creative process of finding a subject, title and angle to write about; and ideation begins with analytics. Most ideation is done in a team setting, but freelance writers are usually on their own. Which is why it’s helpful to know how professional marketing teams generate ideas. Before doing that, successful content writers need to:

  • Understand your audience. Marketers call it creating a “buyer persona.” If you know who your readers are, you can write what they want to read. You write for your audience. Not for yourself, not for your company, not for your brand.
    Perform keyword research. Buzzsumo.com showed that “content writing” is a better keyword than “content writer,” which is what led to a title change. The site also revealed that writing how-to posts are popular. One by Neil Patel on how to come up with topic ideas was shared nearly 16,000 times
  • Check out the competition. What successful content are others in your industry sharing? A competitive content audit gives you a ton of information. Not just about what your competitors are sharing, but who is linking to their content, blogging about it, tweeting it out and posting it elsewhere
  • Craft a snappy title. After you have keyword, competitor and reader knowledge, take your time, choose your subject and craft a title that will interest readers. The title compels people to read. . . or not. The most important words on your post are the title and the meta description

Be original

To build a successful career in content writing every post with your name on it should be original. That probably sounds crazy, with all the tens of thousands of people writing about the same subjects, but it’s easier than it seems. Every talented writer can bring a unique voice, different perspective or new light to an overworked subject.

Plagiarized content is bad for SEO, bad for your employers and even worse for you. Protect your reputation and your career by taking precautions. Before you submit your work, use an online program to check for plagiarism. With all the content out there, it’s easy to accidentally duplicate writing.

Knowledge of SEO, HTML, CSS and WordPress

You need to know the basics. WordPress themes have varying levels of automatic functions, and sometimes the only way to make your text appear the way you want it to is to dig into the text/HTML tab and manipulate the code to make a title tag or fix a spacing issue. It’s worth your time to learn the basics.

Updated SEO knowledge is also critical. Search engine algorithms change constantly, and writers have to keep up. One thing remains constant: High quality is always in demand. If you can write in-depth content from a unique perspective, you’ll be in demand.

Hone your social media skills

Name recognition is important. Social media puts everything you need within your grasp. Build your audience, meet publishers and talk to industry experts. When your writing is published, the fun has only just begun. The more active you are on social media, the more likely your followers will be to recommend your content. Successful content writers are active, public and friendly.

So, think again about writing “success.” It stops being about words on paper as soon as “content” is added to “writer.” Content writers are marketing experts, SEO specialists, on-page coders and social media butterflies. With the right skill set, you’ll succeed and find that yours is the best job in the world.

How to write great content?

Content Writing as Career

There is an upcoming market for content writers with Digital Marketing being the next best thing for all companies. You will get a job for sure under many start-up companies trying to market their product through content and Digital marketing.

This era has opened up a vast scope for people pursuing the profession of content writing.