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">
</keygen>

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>

result:

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"> 
</head> 
<body> <p>Paragraph 1</p> 
<p>Paragraph 2</p> <link href="style2.css" rel="stylesheet"> 
</body>

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
<ul>
 <li>A list item
 <li>Another list item
</ul>

the above html will be parsed as the following blocks :

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

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?

Answer:
<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?

Answer:

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.

example:

localStorage.empid=”123″;

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  */
    }
    </style>
  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 {
.rounded-corners;
}

#maintable {
.rounded-corners(5px);
}

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(){
function(){
/*…*/
},
return{
/*…*/
}
})();

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;
}
}
creator.call(ns);

// 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.
SOAP:

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.

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?

OOP PHP


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.