What is the tag for moving text Up to down or left ot right or vise versa ?

Use the tag : <marquee> for this !!

What is the marquee property for text to move from bottom to upside

apply : direction=”up” property to move from bottom to upside !!

How do u manage the speed of <marquee> ??

with the use of : scrollamount peoperty !!
low means less and high means more speed !!

Which property will you use to restrict browser not to show the previous used values in the Textbox


What’s the AutoComplete property’s value to Restrict the previous values used not to appear in the textbox in browser ?

AutoComplete = “off”

How can you restrict all the textbox’s autocomplete to off in a form ?

Set AutoComplete = “off” of the form.

What is the use of page-break-after?

To Break (start new page) the page after the element. this is basically used while printing a form etc.
<div style=”page-break-after:always;”>Lakhan Pal Garg </div>
<div>My Blog name is : </div>

Out put will be as :
Lakhan Pal Garg (First Page)
My Blog name is : (Second Page)

What is the use of page-break-before

To Break (start new page) the page before the element. this is basically used while printing a form etc.
<div>Lakhan Pal Garg </div>
<div style=”page-break-before:always;”>My Blog name is : </div>

Out put will be as :
Lakhan Pal Garg (First Page)
My Blog name is : (Second Page)

what to do when my Flash Object or Flash Embed is coming over the other controls like drop down menus.

To avoid hiding the Menus by the Flash objects we can use WMODE property with EMBED Tag.
We need to Setwmode=transparent

For that we also need to at WMODE parameter with Object Tag.

Below is one Sample Example :
In Object Tag, we need to write
param name=”wmode” value=”transparent”
and with Embed Tag, we need to write wmode=”transparent”

We can also use :
<param name=”wmode” value=”opaque” /> with object parameters.

You can Check this link as Reference :

Modified By :

What are differences between HTML and DHTML?

1. It is referred as a static HTML and static in nature.
2.A plain page without any styles and Scripts called as HTML.
3.HTML sites will be slow upon client-side technologies.

1.It is referred as a dynamic HTML and dynamic in nature.
2.A page with HTML, CSS, DOM and Scripts called as DHTML.
3.DHTML sites will be fast enough upon client-side technologies.

A URL specifies which of the following functionalities ? (a) protocol used (d) domain name of server hosting web page (c) name of folder with required information (b) name of document formatted using HTML (e) the name of ISP

NOTE: This is objective type question, Please click question title for correct answer.

Among all the services which are provided by World Wide Web which of the following comes under that ? (a)Encryption (b)HTTP (c)HTML (d)Firewalls

NOTE: This is objective type question, Please click question title for correct answer.

What is the difference between <% %>, <%= %>, <%# %>?

• The codes written in <% %> can be treated as server side code in script languages.

• The code written in <%= %> is used for accessing any server side variable into the HTML (in .aspx) page.

• The code written in <%# %> is for the binding control like repeater, gridview etc. Basically this is used to bind the particular column with the database value when the Autogenerate column of the binding control is false.

Can we have two body tags on a .html page?

Yes, we can have 2 body tags on a .html page


<body bgColor="lightblue">



<body bgColor="lightgreen">




//output: the backcolor of the body will be lightblue,
//but the headers of both the body tags will be visible in the output.

what are the different types of storage in HTML 5?

HTML5 offers two new objects for storing data on the client:

LocalStorage – stores data with no time limit

<script type="text/javascript">




SessionStorage – stores data for one session.The data is deleted when the user closes the browser window.

<script type="text/javascript">




details on W3schools :

Difference between XML and HTML.

-Both XML and HTML are based on SGML – Standard Generalized Markup Language

Different goals
- XML was designed to describe data and to focus on what data is
- HTML was designed to display data and to focus on how data looks
- XML fundamentally separates content (data and language) from presentation; HTML specifies the presentation

- HTML explicitly defines a set of legal tags as well as grammar (intended meaning)

- XML allows any tags or grammar to be used hence eXtensible

Are all the below border styles valid :- border-style: inset; border-style: outset; border-style: double; border-style: dotted; border-style: dashed; border-style: solid; border-style: none; border-style: groove; border-style: ridge; border-style: hidden;

NOTE: This is objective type question, Please click question title for correct answer.

What are the header (<head>) section changes in HTML5 ?

Basically below are the two changes in HTML5 head section ”

1) Removed “http-equiv=”Content-Type” content=”text/html; ” attribute if the http-equiv=”Content-Type” attributes form the META charset tag .

In Earlier version of HTML : charset meta tag is like given below

<meta http-equiv="Content-Type" content="text/html;  content="text/html; charset=utf-8" />


< meta charset="utf-8" />

2 ) No More Types for Scripts and Links

In Earlier version of HTML:

<link rel="stylesheet" href="~\stylesheet.css" type="text/css" />

     < script type="text/javascript" src="~\script.js" />

In Html5 : No need to import type=”text/css” in case of CSS and type=”text/javascript” in JavaScript

< link rel="stylesheet" href="~\stylesheet.css" / >  

     < script src="~\script.js" / >

In HTML 5, what is the declaration of the doctype ?

<!DOCTYPE html>

The above declaration tells the browser that the version of the html is 5.

In the previous version of the html that is 4.0. We used to write the doctype as :-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

In HTML 5, we don’t need to write lengthy doctype declaration similar to html 4.

What is SPA ?

Single Page application(SPA) is a web application or web site that fits on a single web page which provides a more fluid UX akin to a desktop application by loading all necessary code (using HTML, JavaScript, and CSS) with single page Load.

What is the difference between Canvas and SVG?

What is the difference between Canvas and SVG?

Canvas and SVG both to be considered as multimedia tags in HTML 5.

<canvas> is a simply a rectangular area built with JavaScript functions. The JavaScript API is used to draw vector graphics into a bitmap of a specific size like a paint program. These are pixel-oriented. That means, we cannot change shapes except by overwriting them with other pixels.

SVG stands for Scalable Vector Graphics. <svg> on other hand is a continer for other tags describes the shapes itself. The SVG is used to draw scalable vector graphics in a document format using XML . The drawing is specified as drawing instructions for each shape and any shape can be changed. These drawings are shape-oriented.

What is the purpose of Web Workers API?

If we need to execute a JavaScript file asynchronously and autonomously, we need to take help of Web Workers API. It is a thread that executes a java-script file.It helps to achieve multi threading in web application.

e.g. var worker = new Worker("");

The above code will execute the somejsfile.js – javascript file that has been passed inside the Worker() method.

What is the purpose of HTML5′s Article tag?

It is used to semantically mark the main content section or sections of a page.

An HTML5 page may contain multiple individual parts of main content. For instance, a blog website may contain a page with multiple blog posts in. In that case, each blog post would be enclosed in its own article element.





          Company Logo


              <a href="MainPage1.html">Page 1</a>

              <a href="Main2.html">Page 2</a>            




            <a href="Subpage1.html">SubPage 1</a>

            <a href="Subpage2.html">SubPage 2</a>            



            <p>Main content section 1</p>



            <p>Main content section 2</p>





What is an iframe in HTML?

An iframe is used to display a web page within a web page.

<iframe src=””>
<p>Your browser does not support iframes.</p>

Some old browsers do not support iframe. In that case, text between the opening <iframe> and closing </iframe> tag will be displayed.

What is a <frameset> tag?

The <frameset> tag defines a frameset.

The <frameset> element holds one or more <frame> elements. Each <frame> element can hold a separate document.

The <frameset> element specifies how many columns or rows there will be in the frameset, and how much percentage/pixels of space will occupy each of them.


<frameset cols="25%,*,25%">

  <frame src="frame1.htm" />

  <frame src="frame2.htm" />

  <frame src="frame3.htm" />


What is a <dl> tag in HTML?

<dl> is a definition list tag used in conjunction with
1. <dt> tag —> defines an item in the list
2. <dd> tag —> describes an item in the list.

<dd>- An entertainment media with audio and video </dd>
<dd>-An entertainment media with audio alone</dd>

What is a <fieldset>tag?

The <fieldset> tag is used to group related elements in a form.
The <fieldset> tag draws a box around the related elements.




    <legend>Employee Information:</legend>

    Emp Name: <input type="text" /><br />

    Email: <input type="text" /><br />

    Date of Joining: <input type="text" />



Is it possible to specify a link without underlining using HTML?

Yes, it is possible. Let us see an example..



<a href="" style="text-decoration:none;">Visit!</a>



Text-decoration: none style is used not to underline a anchor element.

How can an abbreviation be specified in HTML?

The <abbr> tag is used to provide abbreviation. The title attribute is used in the <abbr> tag, to show the full version of the abbreviation when you mouse over it.

<p>The <abbr title=”DotNetFunda”>DNF</abbr></p>
When you place mouse over DNF it displays “Dot Net Funda”.

How can you specify an acronym in HTML?

The <acronym> tag defines an acronym. By marking up acronyms you can give useful information to browsers, spell checkers, translation systems and search-engine indexers.
The title attribute is used to show the full version of the acronym when you mouse over it.


<p>Can I get this <acronym title="as soon as possible">ASAP</acronym>?</p>

How to insert horizontal lines in HTML?

The <hr> tag is used to insert a horizntal line.

Example: <html>


<p>The hr tag defines a horizontal rule:</p>

<hr />

<p>This is a paragraph 1</p>

<hr />

<p>This is a paragraph 2</p>

<hr />

<p>This is a paragraph 3</p>



How to mark deleted text and inserted text?

<ins> and <del> tags are used to mark the inserted and deleted text respectively.
The browsers will strikethrough deleted text and underline inserted text.




<p>My favorite color is <del>blue</del> <ins>red</ins>!</p>



How to link an external css file to HTML?

The <link> tag is used to link an external file and the type attribute should be set to “text/css” to refer a style sheet.




<link rel="stylesheet" type="text/css" href="styles.css" />




How to open a link in a new window in HTML?

If you set the target attribute to “_blank” in the <a> tag, the link will open in a new browser window/tab.




<a href="" target="_blank">Visit!</a> 



How to jump another part of the document in the same page?

href and name attribute in the <a> anchor tag is used to jump to another part of the document.


<a href=”#C4″>Bottom</a>

<h2>Chapter 1</h2>
<p>This is chapter 1</p>

<h2>Chapter 2</h2>
<p>This is chapter 2</p>

<h2>Chapter 3</h2>
<p>This is chapter 3</p>

<h2><a name=”C4″>Top</a></h2>
<p>This is chapter 4</p>


How to link to a mail message in HTML?

The <a> anchor tag with href with the value as specifed is used to link to a mail message only if the mail is installed in the machine.
Spaces between words for the subject should be replaced by %20 to ensure that the browser will display the text properly





<a href="">

Send Mail</a>




How can you create a table with vertical table headers?

In each row provide the first column tag as <th> and refer the example below.




<h4>Vertical headers:</h4>

<table border="1">


  <th>First Name:</th>

  <td>Charles Babbage</td>



  <th>Telephone 1:</th>

  <td>555 52 896</td>



  <th>Telephone 2:</th>

  <td>555 74 563</td>





How can you provide heading to a table?

The <caption> tag inside the <table. tag is used to provide caption to the table.




<table border="1">

  <caption>Monthly Savings</caption>
















How to have a table cell that spans two columns in HTML?

The <colspan> tag inside a <th> or <td> tag is used to span the columns.
Let us see an example.




<h4>Cell that spans two columns:</h4>

<table border="1">



  <th colspan="2">Telephone</th>



  <td>Charles Babbage</td>

  <td>555 89 123</td>

  <td>555 98 321</td>





How to have a table cell that spans two rows in HTML?

The <rowspan> tag is used to span two rows.




<h4>Cell that spans two rows:</h4>

<table border="1">


  <th>First Name:</th>

  <td>Charles Babbage</td>



  <th rowspan="2">Telephone:</th>

  <td>555 82 982</td>



  <td>555 86 986</td>





What is the full form of URI, URL, URN?

URI – Uniform Resource Identifier
URL – Uniform Resource Locator
URN – Uniform Resource Name

Write code for a html table that will have one row and one column?







Whys Html used extensively for creating websites

NOTE: This is objective type question, Please click question title for correct answer.

Difference between GET and POST Metods

Difference Between GET and POST methods

1) Data is appended to the URL.
2) Data is not secret.
3) It is a single call system
4) Maximum data that can be sent is 256.
5) Data transmission is faster
6) This is the default method for many browsers

1) Data is appended to the URL.
2) Data is Secret
3) It is a two call system.
4) There is no Limit on the amount of data.That is characters any amount of data can be sent.
5) Data transmission is comparatively slow.
6) No default and should be Explicitly specified.

Why to specify the alt value in the img tag?

alt stands for alternate this means that for some reason if image can’t be loaded on the page, the alt value will be displayed.

<img src="myimage.jpg" alt="this is my photo" title="click to go to my page" />

In the above code snippet when myimage.jpg is available on the web server, the image will be displayed and mouse ever on the image will show “click to go to my page” but in case myimage.jpg is not available on the server or by some reason it could’t be rendered on the page, alt value (this is my photo) will be displayed in place of image. This hints the user that the picture that couldn’t be loaded was my photo.

How to add javascript file reference in the web page?

We can use <script> tag to refer the .js file available on the server, we can not only refer only those file that are on our server but we cal also any .js file that is available on other server (on other domain.

<script src="/include/myjscode.js" type="text/javascript"></script>

It is always suggested to place the script tag inside <head></head>

How to display the web page icon in the browser?

By placing the link tag inside the <head></head and specify rel value as “shortcut icon”, you can display the page icon in the browser.

<link rel="shortcut icon" href="/images/myicon.gif" />

Here, you can either specify .gif, .jpg or .ico file, however many browser only support .ico file not .gif or .jpg file.

How to refer the .css file in the web page?

To refer .css file in the web page, use <link> tag. Generally it is suggested to keep this inside the <head></head> tag.

<link href="/css/mystyle.css" type="text/css" rel="stylesheet" />

Notice that the type attribute value should be “text/css” and rel attribute value should be “stylesheet”.

How to write bulleted point in HTML?

To write bulleted point, use <li> under <ul> like following.


        <li>Point 1</li> 

        <li>Point 2</li> 

        <li>Point 3</li> 


In this case Point 1, Point 2 and Point 3 will appear as bulleted point.

How to display numbered list in HTML?

To display numbered list, use <li> under <ol> tag like below


     <li>Point 1</li>

     <li>Point 2</li>


How to create a DropDown list box?

To create a dropdown list box in HTML, write following code

  <select name="drop1" id="drop1"> 

	<option value="1">item 1</option> 

	<option value="2">item 2</option> 

	<option value="0">All</option> 


This will create a dropdown with two list item “item 1″ and “item 2″.

How to create a ListBox in HTML?

To create a list box, write following code

<select name="drop1" id="Select1" size="4" multiple="multiple">

    <option value="1">item 1</option>

    <option value="2">item 2</option>

    <option value="3">item 3</option>

    <option value="4">item 4</option>

    <option value="0">All</option>


This will create a listbox with 5 items. As multiple attribute value is specified as =”multiple” so it gives ability to select more than one item from the box by holding ctrl key or by dragging through items from the mouse.

Should we use table tag to design the layout of the webpage?

No, <table> tag is made for rendering the data in tabular format not to design the layout of the webpage, however this is massively used for the designer because its easy to use.

To design the layout we should use <div> and/or <span> along with css classes.

What is the code to write bulleted and numbered list in HTML.

To write bulleted list in the HTML, write following code:


  <li>fdasfadsf asdf</li>





To write numbered list in the HTML, write following code:


  <li>fdasfadsf asdf</li>





Notice the difference is only <ul> and <ol>. In the bulleted list, we need to use <ul> tag and in the numbered list we need to use <ol> tag.

What is <!DOCTYPE> defines in HTML?

Doctype defines as “document type declaration” (DTD).

All HTML pages should contain a <!DOCTYPE> declaration to define which HTML version we are using in our page. it gives important instruction to web browser about page’s HTML version type. It also allows web validator to check the syntax of page.

How FontSize and Font Size is differ in HTML?

font size is an attribute that we used in font tag.
Ex : <font size=”5″> use in font tag.

Where as font-size is an style property used for controls.
Ex : Font-Size=”Small” use for style property For Controls.

How to forbid autocomplete for a form ?

use autocomplete=”off”

What is the user of alt property in <img> tag?

The use of “alt” property of <img> tag is to display the alt value in case browser is unable to load the image so that the end user can understand what kind of image was actually there on the page that couldn’t be loaded.

What is the use of title property of <img> tag?

The title property of <img> tag is used to describe about the image. The value of title property is displayed when the end user mouse over the image.

What should be the href property value of anchor tag in case we want to handle the click event

The href property of anchor tag should be “javascript:void(0)” when we want to handle the click event of the anchor tag. Many people keep href=”#” that jump the screen to top when the link is clicked.

<a id="closeLink"  href="javascript:void(0)" onclick="Clicked()" title="Whatever">Whatever link</a>

In other way we can also write like this

<a id="closeLink"  href="javascript:Clicked()" title="Whatever">Whatever link</a>

PHP Interview Questions and Answer

  1. What is PHP?

PHP is a server side scripting language commonly used for web applications. PHP has many frameworks and cms for creating websites.Even a non technical person can cretae sites using its CMS.WordPress,osCommerce are the famus CMS of php.It is also an object oriented programming language like java,C-sharp etc.It is very eazy for learning

  1. What is the use of “echo” in php?

It is used to print a data in the webpage, Example: <?php echo ‘Car insurance’; ?> , The following code print the text in the webpage

  1. How to include a file to a php page?

We can include a file using “include() ” or “require()” function with file path as its parameter.

  1. What’s the difference between include and require?

If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.

  1. require_once(), require(), include().What is difference between them?

require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page). So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don’t include the file more times and you will not get the “function re-declared” error.

  1. Differences between GET and POST methods ?

We can send 1024 bytes using GET method but POST method can transfer large amount of data and POST is the secure method than GET method .

  1. How to declare an array in php?

Eg : var $arr = array(‘apple’, ‘grape’, ‘lemon’);

  1. What is the use of ‘print’ in php?

This is not actually a real function, It is a language construct. So you can use with out parentheses with its argument list.
Example print(‘PHP Interview questions’);
print ‘Job Interview ’);

  1. What is use of in_array() function in php ?

in_array used to checks if a value exists in an array

  1. What is use of count() function in php ?

count() is used to count all elements in an array, or something in an object

  1. What’s the difference between include and require?

It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.

  1. What is the difference between Session and Cookie?

The main difference between sessions and cookies is that sessions are stored on the server, and cookies are stored on the user’s computers in the text file format. Cookies can not hold multiple variables,But Session can hold multiple variables.We can set expiry for a cookie,The session only remains active as long as the browser is open.Users do not have access to the data you stored in Session,Since it is stored in the server.Session is mainly used for login/logout purpose while cookies using for user activity tracking

  1. How to set cookies in PHP?

Setcookie(“sample”, “ram”, time()+3600);

  1. How to Retrieve a Cookie Value?

eg : echo $_COOKIE["user"];

  1. How to create a session? How to set a value in session ? How to Remove data from a session?

Create session : session_start();
Set value into session : $_SESSION['USER_ID']=1;
Remove data from a session : unset($_SESSION['USER_ID'];

  1. what types of loops exist in php?

for,while,do while and foreach (NB: You should learn its usage)

  1. How to create a mysql connection?


  1. How to select a database?


  1. How to execute an sql query? How to fetch its result ?

$my_qry = mysql_query(“SELECT * FROM `users` WHERE `u_id`=’1′; “);
$result = mysql_fetch_array($my_qry);
echo $result['First_name'];

  1. Write a program using while loop

$my_qry = mysql_query(“SELECT * FROM `users` WHERE `u_id`=’1′; “);
while($result = mysql_fetch_array($my_qry))
echo $result['First_name'.].”<br/>”;

  1. How we can retrieve the data in the result set of MySQL using PHP?
    • 1. mysql_fetch_row
    • 2. mysql_fetch_array
    • 3. mysql_fetch_object
    • 4. mysql_fetch_assoc
  2. What is the use of explode() function ?

Syntax : array explode ( string $delimiter , string $string [, int $limit ] );
This function breaks a string into an array. Each of the array elements is a substring of string formed by splitting it on boundaries formed by the string delimiter.

  1. What is the difference between explode() and split() functions?

Split function splits string into array by regular expression. Explode splits a string into array by string.

  1. What is the use of mysql_real_escape_string() function?

It is used to escapes special characters in a string for use in an SQL statement

  1. Write down the code for save an uploaded file in php.

if ($_FILES["file"]["error"] == 0)
“upload/” . $_FILES["file"]["name"]);
echo “Stored in: ” . “upload/” . $_FILES["file"]["name"];

  1. How to create a text file in php?

$filename = “/home/user/guest/newfile.txt”;
$file = fopen( $filename, “w” );
if( $file == false )
echo ( “Error in opening new file” ); exit();
fwrite( $file, “This is a simple test\n” );
fclose( $file );

  1. How to strip whitespace (or other characters) from the beginning and end of a string ?

The trim() function removes whitespaces or other predefined characters from both sides of a string.

  1. What is the use of header() function in php ?

The header() function sends a raw HTTP header to a client browser.Remember that this function must be called before sending the actual out put.For example, You do not print any HTML element before using this function.

  1. How to redirect a page in php?

The following code can be used for it, header(“Location:index.php”);

  1. How stop the execution of a php scrip ?

exit() function is used to stop the execution of a page

  1. How to set a page as a home page in a php based site ?

index.php is the default name of the home page in php based sites

  1. How to find the length of a string?

strlen() function used to find the length of a string

  1. what is the use of rand() in php?

It is used to generate random numbers.If called without the arguments it returns a pseudo-random integer between 0 and getrandmax(). If you want a random number between 6 and 12 (inclusive), for example, use rand(6, 12).This function does not generate cryptographically safe values, and should not be used for cryptographic uses. If you want a cryptographically secure value, consider using openssl_random_pseudo_bytes() instead.

  1. what is the use of isset() in php?

This function is used to determine if a variable is set and is not NULL

  1. What is the difference between mysql_fetch_array() and mysql_fetch_assoc() ?

mysql_fetch_assoc function Fetch a result row as an associative array, Whilemysql_fetch_array() fetches an associative array, a numeric array, or both

  1. What is mean by an associative array?

Associative arrays are arrays that use string keys is called associative arrays.

  1. What is the importance of “method” attribute in a html form?

“method” attribute determines how to send the form-data into the server.There are two methods, get and post. The default method is get.This sends the forminformation by appending it on the URL.Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

  1. What is the importance of “action” attribute in a html form?

The action attribute determines where to send the form-data in the formsubmission.

  1. What is the use of “enctype” attribute in a html form?

The enctype attribute determines how the form-data should be encoded when submitting it to the server. We need to set enctype as “multipart/form-data”when we are using a form for uploading files

  1. How to create an array of a group of items inside an HTML form ?

We can create input fields with same name for “name” attribute with squire bracket at the end of the name of the name attribute, It passes data as an array to PHP.
For instance :

<input name=”MyArray[]” />  <input name=”MyArray[]” />  <input name=”MyArray[]” />  <input name=”MyArray[]” />

  1. Define Object-Oriented Methodology

Object orientation is a software/Web development methodology that is based on the modeling a real world system.An object is the core concept involved in the object orientation. An object is the copy of the real world enity.An object oriented model is a collection of objects and its inter-relationships

  1. How do you define a constant?

Using define() directive, like define (“MYCONSTANT”,150)

  1. How send email using php?

To send email using PHP, you use the mail() function.This mail() function accepts 5 parameters as follows (the last 2 are optional). You need webserver, you can’t send email from localhost. eg : mail($to,$subject,$message,$headers);

  1. How to find current date and time?

The date() function provides you with a means of retrieving the current date and time, applying the format integer parameters indicated in your script to the timestamp provided or the current local time if no timestamp is given. In simplified terms, passing a time parameter is optional – if you don’t, the current timestamp will be used.

  1. Difference between mysql_connect and mysql_pconnect?

There is a good page in the php manual on the subject, in short mysql_pconnect() makes a persistent connection to the database which means a SQL link that do not close when the execution of your script ends. mysql_connect()provides only for the databasenewconnection while using mysql_pconnect , the function would first try to find a (persistent) link that’s already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection… the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use.

  1. What is the use of “ksort” in php?

It is used for sort an array by key in reverse order.

  1. What is the difference between $var and $$var?

They are both variables. But $var is a variable with a fixed name. $$var is a variable who’s name is stored in $var. For example, if $var contains “message”, $$var is the same as $message.

  1. What are the encryption techniques in PHP

MD5 PHP implements the MD5 hash algorithm using the md5 function,
eg : $encrypted_text = md5 ($msg);

mcrypt_encrypt :- string mcrypt_encrypt ( string $cipher , string $key , string $data , string $mode [, string $iv ] );
Encrypts plaintext with given parameters

  1. What is the use of the function htmlentities?

htmlentities Convert all applicable characters to HTML entities This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.

  1. How to delete a file from the system

Unlink() deletes the given file from the file system.

  1. How to get the value of current session id?

session_id() function returns the session id for the current session.

  1. What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?
    • Mysql_fetch_array Fetch a result row as an associative array, a numeric array, or both.
    • mysql_fetch_object ( resource result ) Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead. Returns an object with properties that correspond to the fetched row, or FALSE if there are no more rows
    • mysql_fetch_row() fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0.
  2. What are the different types of errors in PHP ?

Here are three basic types of runtime errors in PHP:

    • 1. Notices: These are trivial, non-critical errors that PHP encounters while executing a script – for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all – although you can change this default behavior.
    • 2. Warnings: These are more serious errors – for example, attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination.
    • 3. Fatal errors: These are critical errors – for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP’s default behavior is to display them to the user when they take place.
  1. what is sql injection ?

SQL injection is a malicious code injection technique.It exploiting SQL vulnerabilities in Web applications

  1. What is x+ mode in fopen() used for?

Read/Write. Creates a new file. Returns FALSE and an error if file already exists

  1. How to find the position of the first occurrence of a substring in a string

strpos() is used to find the position of the first occurrence of a substring in a string

  1. What is PEAR?

PEAR is a framework and distribution system for reusable PHP components.The project seeks to provide a structured library of code, maintain a system for distributing code and for managing acode packages, and promote a standard coding style.PEAR is broken into three classes: PEAR Core Components, PEAR Packages, and PECL Packages. The Core Components include the base classes of PEAR and PEAR_Error, along with database, HTTP, logging, and e-mailing functions. The PEAR Packages include functionality providing for authentication, networking, and file system features, as well as tools for working with XML and HTML templates.

  1. Distinguish between urlencode and urldecode?

This method is best when encode a string to used in a query part of a url. it returns a string in which all non-alphanumeric characters except -_. have replece with a percentege(%) sign . the urldecode->Decodes url to encode string as any %and other symbole are decode by the use of the urldecode() function.

  1. What are the different errors in PHP?

In PHP, there are three types of runtime errors, they are:

These are important errors. Example: When we try to include () file which is not available. These errors are showed to the user by default but they will not result in ending the script.
These errors are non-critical and trivial errors that come across while executing the script in PHP. Example: trying to gain access the variable which is not defined. These errors are not showed to the users by default even if the default behavior is changed.
Fatal errors:
These are critical errors. Example: instantiating an object of a class which does not exist or a non-existent function is called. These errors results in termination of the script immediately and default behavior of PHP is shown to them when they take place. Twelve different error types are used to represent these variations internally.


Core Java – Interview Questions and Answers

1. What is the most important feature of Java?

Java is a platform independent language.

2. What do you mean by platform independence?

Platform independence means that we can write and compile the java code in one platform (eg Windows) and can execute the class in any other supported platform eg (Linux,Solaris,etc).

3. What is a JVM?

JVM is Java Virtual Machine which is a run time environment for the compiled java class files.

4. Are JVM’s platform independent?

JVM’s are not platform independent. JVM’s are platform specific run time implementation provided by the vendor.

5. What is the difference between a JDK and a JVM?

JDK is Java Development Kit which is for development purpose and it includes execution environment also. But JVM is purely a run time environment and hence you will not be able to compile your source files using a JVM.

6. What is a pointer and does Java support pointers?

Pointer is a reference handle to a memory location. Improper handling of pointers leads to memory leaks and reliability issues hence Java doesn’t support the usage of pointers.

7. What is the base class of all classes?


8. Does Java support multiple inheritance?

Java doesn’t support multiple inheritance.

9. Is Java a pure object oriented language?

Java uses primitive data types and hence is not a pure object oriented language.

10. Are arrays primitive data types?

In Java, Arrays are objects.

11. What is difference between Path and Classpath?

Path and Classpath are operating system level environment variales. Path is used define where the system can find the executables(.exe) files and classpath is used to specify the location .class files.

12. What are local variables?

Local varaiables are those which are declared within a block of code like methods. Local variables should be initialised before accessing them.

13. What are instance variables?

Instance variables are those which are defined at the class level. Instance variables need not be initialized before using them as they are automatically initialized to their default values.

14. How to define a constant variable in Java?

The variable should be declared as static and final. So only one copy of the variable exists for all instances of the class and the value can’t be changed also.
static final int PI = 2.14; is an example for constant.

15. Should a main() method be compulsorily declared in all java classes?

No not required. main() method should be defined only if the source class is a java application.

16. What is the return type of the main() method?

Main() method doesn’t return anything hence declared void.

17. Why is the main() method declared static?

main() method is called by the JVM even before the instantiation of the class hence it is declared as static.

18. What is the arguement of main() method?

main() method accepts an array of String object as arguement.

19. Can a main() method be overloaded?

Yes. You can have any number of main() methods with different method signature and implementation in the class.

20. Can a main() method be declared final?

Yes. Any inheriting class will not be able to have it’s own default main() method.

21. Does the order of public and static declaration matter in main() method?

No. It doesn’t matter but void should always come before main().

22. Can a source file contain more than one class declaration?

Yes a single source file can contain any number of Class declarations but only one of the class can be declared as public.

23. What is a package?

Package is a collection of related classes and interfaces. package declaration should be first statement in a java class.

24. Which package is imported by default?

java.lang package is imported by default even without a package declaration.

25. Can a class declared as private be accessed outside it’s package?

Not possible.

26. Can a class be declared as protected?

A class can’t be declared as protected. only methods can be declared as protected.

27. What is the access scope of a protected method?

A protected method can be accessed by the classes within the same package or by the subclasses of the class in any package.

28. What is the purpose of declaring a variable as final?

A final variable’s value can’t be changed. final variables should be initialized before using them.

29. What is the impact of declaring a method as final?

A method declared as final can’t be overridden. A sub-class can’t have the same method signature with a different implementation.

30. I don’t want my class to be inherited by any other class. What should i do?

You should declared your class as final. But you can’t define your class as final, if it is an abstract class. A class declared as final can’t be extended by any other class.

31. Can you give few examples of final classes defined in Java API?

java.lang.String, java.lang.Math are final classes.

32. How is final different from finally and finalize()?

final is a modifier which can be applied to a class or a method or a variable. final class can’t be inherited,final method can’t be overridden and final variable can’t be changed.

finally is an exception handling code section which gets executed whether an exception is raised or not by the try block code segment.

finalize() is a method of Object class which will be executed by the JVM just before garbage collecting object to give a final chance for resource releasing activity.

33. Can a class be declared as static?

We can not declare top level class as static, but only inner class can be declared static.

public class Test
    static class InnerClass
        public static void InnerMethod()
        { System.out.println("Static Inner Class!"); }
    public static void main(String args[])
//output: Static Inner Class!

34. When will you define a method as static?

When a method needs to be accessed even before the creation of the object of the class then we should declare the method as static.

35. What are the restriction imposed on a static method or a static block of code?

A static method should not refer to instance variables without creating an instance and cannot use “this” operator to refer the instance.

36. I want to print “Hello” even before main() is executed. How will you acheive that?

Print the statement inside a static block of code. Static blocks get executed when the class gets loaded into the memory and even before the creation of an object. Hence it will be executed before the main() method. And it will be executed only once.

37. What is the importance of static variable?

static variables are class level variables where all objects of the class refer to the same variable. If one object changes the value then the change gets reflected in all the objects.

38. Can we declare a static variable inside a method?

Static varaibles are class level variables and they can’t be declared inside a method. If declared, the class will not compile.

39. What is an Abstract Class and what is it’s purpose?

A Class which doesn’t provide complete implementation is defined as an abstract class. Abstract classes enforce abstraction.

40. Can a abstract class be declared final?

Not possible. An abstract class without being inherited is of no use and hence will result in compile time error.

41. What is use of a abstract variable?

Variables can’t be declared as abstract. only classes and methods can be declared as abstract.

42. Can you create an object of an abstract class?

Not possible. Abstract classes can’t be instantiated.

43. Can a abstract class be defined without any abstract methods?

Yes it’s possible. This is basically to avoid instance creation of the class.

44. Class C implements Interface I containing method m1 and m2 declarations. Class C has provided implementation for method m2. Can i create an object of Class C?

No not possible. Class C should provide implementation for all the methods in the Interface I. Since Class C didn’t provide implementation for m1 method, it has to be declared as abstract. Abstract classes can’t be instantiated.

45. Can a method inside a Interface be declared as final?

No not possible. Doing so will result in compilation error. public and abstract are the only applicable modifiers for method declaration in an interface.

46. Can an Interface implement another Interface?

Intefaces doesn’t provide implementation hence a interface cannot implement another interface.

47. Can an Interface extend another Interface?

Yes an Interface can inherit another Interface, for that matter an Interface can extend more than one Interface.

48. Can a Class extend more than one Class?

Not possible. A Class can extend only one class but can implement any number of Interfaces.

49. Why is an Interface be able to extend more than one Interface but a Class can’t extend more than one Class?

Basically Java doesn’t allow multiple inheritance, so a Class is restricted to extend only one Class. But an Interface is a pure abstraction model and doesn’t have inheritance hierarchy like classes(do remember that the base class of all classes is Object). So an Interface is allowed to extend more than one Interface.

50. Can an Interface be final?

Not possible. Doing so so will result in compilation error.



HTML markup tags are usually called HTML tags

  • HTML tags are keywords (tag names) surrounded by angle brackets like <html>
  • HTML tags normally come in pairs like <b> and </b>
  • The first tag in a pair is the start tag, the second tag is the end tag
  • The end tag is written like the start tag, with a forward slash before the tag name
  • Start and end tags are also called opening tags and closing tags

What is HTML?

HTML is a language for describing web pages.

  • HTML stands for Hyper Text Markup Language
  • HTML is a markup language
  • A markup language is a set of markup tags
  • The tags describe document content
  • HTML documents contain HTML tags and plain text
  • HTML documents are also called web pages


1. What is ASP?

Active Server Pages (ASP), also known as Classic ASP, is a Microsoft’s server-side technology, which helps in creating dynamic and user-friendly Web pages. It uses different scripting languages to create dynamic Web pages, which can be run on any type of browser. The Web pages are built by using either VBScript or JavaScript and these Web pages have access to the same services as Windows application, including ADO (ActiveX Data Objects) for database access, SMTP (Simple Mail Transfer Protocol) for e-mail, and the entire COM (Component Object Model) structure used in the Windows environment. ASP is implemented through a dynamic-link library (asp.dll) that is called by the IIS server when a Web page is requested from the server.

2. What is ASP.NET?

ASP.NET is a specification developed by Microsoft to create dynamic Web applications, Web sites, and Web services. It is a part of .NET Framework. You can create ASP.NET applications in most of the .NET compatible languages, such as Visual Basic, C#, and J#. The ASP.NET compiles the Web pages and provides much better performance than scripting languages, such as VBScript. The Web Forms support to create powerful forms-based Web pages. You can use ASP.NET Web server controls to create interactive Web applications. With the help of Web server controls, you can easily create a Web application.

3. What is the basic difference between ASP and ASP.NET?

The basic difference between ASP and ASP.NET is that ASP is interpreted; whereas, ASP.NET is compiled. This implies that since ASP uses VBScript; therefore, when an ASP page is executed, it is interpreted. On the other hand, ASP.NET uses .NET languages, such as C# and VB.NET, which are compiled to Microsoft Intermediate Language (MSIL).

4. In which event are the controls fully loaded?

Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that view state is not fully loaded during this event

5. How can we identify that the Page is Post Back?

Page object has an “IsPostBack” property, which can be checked to know that is the page posted back.

6. What is the lifespan for items stored in ViewState?

The items stored in ViewState live until the lifetime of the current page expires including the postbacks to the same page.

7. How information about the user’s locale can be accessed?

The information regarding a user’s locale can be accessed by using the System.Web.UI.Page.Cultureproperty.

8. What is the difference between SQL notification and SQL invalidation?

The SQL cache notification generates notifications when the data of a database changes, on which your cache item depends. The SQL cache invalidation makes a cached item invalid when the data stored in a SQL server database changes.

9. Which is the parent class of the Web server control?

The System.Web.UI.Control class is the parent class for all Web server controls.

10. Can you set which type of comparison you want to perform by the CompareValidator control?

Yes, by setting the Operator property of the CompareValidator control.

11. What is the behavior of a Web browser when it receives an invalid element?

The behavior of a Web browser when it receives an invalid element depends on the browser that you use to browse your application. Most of the browsers ignore the invalid element; whereas, some of them display the invalid elements on the page.

12. What are the advantages of the code-behind feature?

The code-behind feature of ASP.NET offers a number of advantages:

  • Makes code easy to understand and debug by separating application logic from HTML tags
  • Provides the isolation of effort between graphic designers and software engineers
  • Removes the problems of browser incompatibility by providing code files to exist on the Web server and supporting Web pages to be compiled on demand.

13. How do you sign out from forms authentication?

  • The FormsAuthentication.Signout() method is used to sign out from the forms authentication.

14. What is AutoPostBack?

  • If you want a control to postback automatically when an event is raised, you need to set the AutoPostBackproperty of the control to True.

15. What is the function of the ViewState property?

  • The ASP.NET 4.0 introduced a new property called ViewStateMode for the Control class. Now you can enable the view state to an individual control even if the view state for an ASP.NET page is disabled.

16. Why do you use the App_Code folder in ASP.NET?

  • The App_Code folder is automatically present in the project. It stores the files, such as classes, typed data set, text files, and reports. If this folder is not available in the application, you can add this folder. One of the important features of the App_Code folder is that only one dll is created for the complete folder, irrespective of how many files it contains.

17. Define a multilingual Web site.

  • A multilingual Web site serves content in a number of languages. It contains multiple copies for its content and other resources, such as date and time, in different languages.

18. What is an ASP.NET Web Form?

  • ASP.NET Web forms are designed to use controls and features that are almost as powerful as the ones used with Windows forms, and so they are called as Web forms. The Web form uses a server-side object model that allows you to create functional controls, which are executed on the server and are rendered as HTML on the client. The attribute, runat=”server”, associated with a server control indicates that the Web form must be processed on the server.

19. What is the difference between a default skin and a named skin?

The default skin is applied to all the Web server controls in a Web form, which are of similar type, and it does not provide a Skin ID attribute. The named skin provides a Skin ID attribute and users have to set the Skin ID property to apply it.

20. What is IIS? Why is it used?

Internet Information Services (IIS) is created by Microsoft to provide Internet-based services to ASP.NET Web applications. It makes your computer to work as a Web server and provides the functionality to develop and deploy Web applications on the server. IIS handles the request and response cycle on the Web server. It also offers the services of SMTP and FrontPage server extensions. The SMTP is used to send emails and use FrontPage server extensions to get the dynamic features of IIS, such as form handler.

21. What is Query String? What are its advantages and limitations?

The Query String helps in sending the page information to the server.

The Query String has the following advantages:

  • Every browser works with Query Strings.
  • It does not require server resources and so does not exert any kind of burden on the server.

The following are the limitations of Query String:

  • Information must be within the limit because URL does not support many characters.
  • Information is clearly visible to the user, which leads to security threats.

22. What is actually returned from server to the browser when a browser requests an .aspx file and the file is displayed?

When a browser requests an .aspx file then the server returns a response, which is rendered into a HTML string.

23. How can you display all validation messages in one control?

The ValidationSummary control displays all validation messages in one control.

24. Which two new properties are added in ASP.NET 4.0 Page class?

The two new properties added in the Page class are MetaKeyword and MetaDescription.

25. What is tracing? Where is it used?

Tracing displays the details about how the code was executed. It refers to collecting information about the application while it is running. Tracing information can help you to troubleshoot an application. It enables you to record information in various log files about the errors that might occur at run time. You can analyze these log files to find the cause of the errors.

In .NET, we have objects called Trace Listeners. A listener is an object that gets the trace output and stores it to different places, such as a window, a file on your locale drive, or a SQL Server.

The System.Diagnostics namespace contains the predefined interfaces, classes, and structures that are used for tracing. It supplies two classes, Trace and Debug, which allow you to write errors and logs related to the application execution. Trace listeners are objects that collect the output of tracing processes.

26. What is the difference between authentication and authorization?

Authentication verifies the identity of a user and authorization is a process where you can check whether or not the identity has access rights to the system. In other words, you can say that authentication is a procedure of getting some credentials from the users and verify the user’s identity against those credentials. Authorization is a procedure of granting access of particular resources to an authenticated user. You should note that authentication always takes place before authorization.

27. How can you register a custom server control to a Web page?

You can register a custom server control to a Web page using the @Register directive.

28. Which ASP.NET objects encapsulate the state of the client and the browser?

The Session object encapsulates the state of the client and browser.

29. Differentiate globalization and localization.

The globalization is a technique to identify the specific part of a Web application that is different for different languages and make separate that portion from the core of the Web application. The localization is a procedure of configuring a Web application to be supported for a specific language or locale.

30. What is ViewState?

The ViewState is a feature used by ASP.NET Web page to store the value of a page and its controls just before posting the page. Once the page is posted, the first task by the page processing is to restore the ViewState to get the values of the controls.


making interview easier