Sunday, December 21, 2014

Interview Question On php for fresher

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

2.    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

3.    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.

4.    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.

5.    What does a special set of tags do in PHP?

In PHP special tags the use of this Tags are The output is displayed directly to the browser.

6.    What is meant by nl2br()?

   Inserts HTML line breaks (

    ) before all newlines in a string.

   7.    What is use of header() function in php ? What is the limitation of HEADER()?
In PHP Important to notice the Limitation of HEADER() function is that header() must be called before any actual output is send. Means must use header function before HTML or any echo statement
There are Number of Use of HEADER() function in php like below
1> The header() function use to sends a raw HTTP header to a client.
2> We can use header() function for redirection of pages.
3> Used to refresh the page on given time interval automatically.
4> To send email header content like cc, bcc , reply to etc data and lot more.

     8.    How can we know the total number of elements of Array?

sizeof($array_var)
count($array_var)
If we just pass a simple var instead of a an array it will return 1.


9. Different Types of Tables in Mysql?

There are Five Types Tables in Mysql

1)INNODB
2)MYISAM
3)MERGE
4)HEAP
5)ISAM

10. Is multiple inheritance supported in PHP?
PHP includes only single inheritance, it means that a class can be extended from only one single  class using the keyword ‘extended’.

11. What is the meaning of a final class and a final method?
‘final’ is introduced in PHP5. Final class means that this class cannot be extended and a final method cannot be overrided.

12. How comparison of objects is done in PHP5?
We use the operator ‘==’ to test is two object are instanced from the same class and have same attributes and equal values. We can test if two object are refering to the same instance of the same class by the use of the identity operator ‘===’.

13. How can PHP and HTML interact?
It is possible to generate HTML through PHP scripts, and it is possible to pass informations from HTML to PHP.

14. What type of operation is needed when passing values through a form or an URL?
If we would like to pass values througn a form or an URL then we need to encode and to decode them using htmlspecialchars() and urlencode().

15. How can PHP and Javascript interact?
PHP and Javascript cannot directly interacts since PHP is a server side language and Javascript is a client side language. However we can exchange variables since PHP is able to generate Javascript code to be executed by the browser and it is possible to pass specific variables back to PHP via the URL.

16. What is needed to be able to use image function?
GD library is needed to be able execute image functions.

17.  What is the use of the function ‘imagetypes()’?
imagetypes() gives the image format and types supported by the current version of GD-                PHP.

18. What are the functions to be used to get the image’s properties (size, width and height)?
The functions are getimagesize() for size, imagesx() for width and imagesy() for height.

19. How failures in execution are handled with include() and require() functions?
If the function require() cannot access to the file then it ends with a fatal error. However, the include() function gives a warning and the PHP script continues to execute.

20.  What is the difference between static and Dynamic Web Sites?
The Web sites were made up of a collection of documents written in the HTML language. The pages were text based, simple, and static. Every time the user reloaded a page in his or her browser, it looked exactly the same. It consisted of HTML text, images, and links. 
                     A dynamic Web site is one with content that is regenerated every time a user visits or reloads the                        site. Although it can be as simple as displaying the current date and time, in most cases it requires                        the use of a database, which contains the site’s information, and a scripting language that can                                retrieve the information from the database. Google and Yahoo! are examples of dynamic sites,                              search engines that create customized pages based on a key word or phrase you type.


No comments:

Post a Comment

About Me

Hello, I am Anamika here and working as HR consultant in Bangalore. I completed my MBA in HRM. My motto is creating this blog for those who need job and desperately looking for job change. I am humbly requesting to all visitor, please support me to make this blog to successful. Thanks :)