GTU MCA PHP Interview Questions And Answers for freshers

Page 1

9/11/2013

TOPS Technologies:http://www.topsint.com/php-training-course.html

1


9/11/2013

2

By TOPS Technologies http://www.tops-int.com/php-training-course.html

TOPS Technologies:http://www.tops-int.com/phptraining-course.html

GTU MCA INTERVIEW QUESTIONS & ANSWERS FOR PHP


GTU MCA INTERVIEW QUESTIONS & ANSWERS FOR PHP 9/11/2013 TOPS Technologies:http://www.topsint.com/php-training-course.html

More then 2000 PHP interview questions and answers on Basic and advance PHP for both freshers and experienced candidate of 1 to 6 year as It covered file system, PHP email, string functions, header functions, pear classes and library, regular expression , array sorting, PHP date format, CURL, PayPal Integration, Shopping cart, PHP Memcache and php framework like zend framework symphony, CodeIgniter cake , YII frameworks etc means all type of PHP questions are going to be coveredin future. Here is a small initialization for our PHP students to prepare for their first industrial interview. -By TOPS Technologies.

3


WHAT IS THE DIFFERENCE BETWEEN A STATIC AND DYNAMIC WEB SITE?

A dynamic website is created by webdevelopers who are strong in ASP.Net, PHP, JAVA and more... This website pages contains data is retrieved from certain database. Each time the viewer entering a page, the contents of that page is retrieved from the database. The administrator can change the content and images from admin panel. This is one that changes or customizes itself frequently and automatically.

TOPS Technologies:http://www.topsint.com/php-training-course.html

A static website is one that is written in HTML only. Each page is a separate document and there is no database that it draws on. What this means functionally is that the only way to edit the site is to go into each page and edit the HTML - So you would have to do it yourself using a web page editor such as FrontPage or Dreamweaver, or pay your web developer to make updates for you.

9/11/2013



4


WHAT IS THE MEANING OF OPEN SOURCE SOFTWARE?

TOPS Technologies:http://www.topsint.com/php-training-course.html

Open-Source Software (OSS) is computer software that is available in source code form: the source code and certain other rights normally reserved for copyright holders are provided under a software license that permits users to study, change, improve and at times also to distribute the software.Open Source Software means it is a free software and no need to buy, we can use full functionallities from this software with certain Terms & Conditions. This license allows modifications and derived works, and allows us to be distributed under the same terms as the license of the original software.

9/11/2013



5


WHY WAS PHP DEVELOPED, WHAT IT IS USED FOR, AND WHERE CAN YOU GET IT?

The PHP scripting language resembles JavaScript, Java, and Perl, These languages all share a common ancestor, the C programming language. PHP has full access to the information that the server has, and very little access to information that the client has. In fact, it only has information that the client tells the server and that the server passes on to PHP. Because it is on the server, however, PHP cannot be modified by the client. While you cannot necessarily trust the information that the client gives to PHP, you can trust that your PHP is doing what you told it to do. Because PHP is on the server end, your PHP scripts can affect your server -- such as by keeping an activity log or updating a database.

TOPS Technologies:http://www.topsint.com/php-training-course.html

PHP developed for less script, time saving, Free Open Source Software and runs on different platforms such as Windows, Linux, Unix, etc. PHP compatible with almost all servers used today such as Apache, IIS, etc.

9/11/2013



6


WHAT ARE THE BENEFITS OF USING PHP AND MYSQL?

Another big advantage of PHP is its interoperability with multiple operating systems. A company can use PHP with either Linux, Windows or Macs for example. They can also use PHP with the popular open source Apache server. Compare that with Microsoft’s Active Server Pages, by contrast, which is primarily designed for Microsoft-enabled servers. Portability is becoming a chief concern for businesses that use one or more operating systems in their businesses. Businesses save money by using PHP to leverage their existing I.S. resources rather than investing large sums of money to purchase proprietary products.

TOPS Technologies:http://www.topsint.com/php-training-course.html

One of the main reasons that businesses choose PHP is its simplicity and ease of use. PHP competes against a number of other web scripting solutions such as Active Server Pages and PERL, but none of these languages are as easy to learn as PHP. Further, some languages require a moderate amount of programming background before a developer can get up to speed in development. With PHP, however, even non-programmers have been able to develop web-based solutions within a matter of days after going through the basic tutorials on PHP. PHP commands are simply embedded into the same web page with HTML commands, and execute on the server to deliver the web pages to the user.

9/11/2013



7


WHAT IS FULL FORM OF PHP ? WHO IS THE FATHER OR INVENTOR OF PHP ?

TOPS Technologies:http://www.topsint.com/php-training-course.html

Answers : 1Rasmus Lerdorf is known as the father of PHP that started development of PHP in 1994 for their own Personal Home Page (PHP) and they released PHP/FI (Forms Interpreter) version 1.0 publicly on 8 June 1995 But in 1997 two Israeli developers named Zeev Suraski and Andi Gutmans rewrote the parser that formed the base of PHP 3 and then changed the language's name to the PHP: Hypertext Preprocessor.

9/11/2013



8


HOW DO YOU CONNET MYSQL DATABASE WITH PHP?

$mysqli = new mysqli("localhost", "username", "password", "dbname"); and in old type of connectivity were $link = mysql_connect("localhost", "username", "password"); mysql_select_db("database",$link);

TOPS Technologies:http://www.topsint.com/php-training-course.html

Answer : We can connect Mysql Database with PHP using both Procedural and Object oriented style like below $link = mysqli_connect("localhost", "username", "password", "dbofpcds");

9/11/2013



9


IN HOW MANY WAYS WE CAN RETRIEVE THE DATA IN THE RESULT SET OFMYSQL USING PHP? WHAT IS THE DIFFERENCE BETWEEN MYSQL_FETCH_OBJECT AND MYSQL_FETCH_ARRAY ?

TOPS Technologies:http://www.topsint.com/php-training-course.html

We can retrieve the data in the result set of MySQL using PHP in 4 Ways 1. mysqli_fetch_row >> Get a result row as an enumerated array 2. mysqli_fetch_array >> Fetch a result row as associative and numeric array 3.mysqli_fetch_object >> Returns the current row of a result set as an object 4. mysqli_fetch_assoc >> Fetch a result row as an associative array mysqli_fetch_object() is similar to mysqli_fetch_array(), with one difference an object is returned, instead of an array. Indirectly, that means that we can only access the data by the field names, and not by their offsets (numbers are illegal property names).

9/11/2013



10


• •

TOPS Technologies:http://www.topsint.com/php-training-course.html

Can we use include ("xyz.PHP") two times in a PHP page "index.PHP"? Yes we can use include("xyz.php") more than one time in any page. but it create a prob when xyz.php file contain some funtions declaration then error will come for already declared function in this file else not a prob like if you want to show same content two time in page then must incude it two time not a prob

9/11/2013

How can we create a database using PHP and MySQL? We can create MySQL database with the use of mysql_create_db("Database Name") Questions : 9What are the differences between require and include?Answers : 9Both include and require used to include a file but when included file not found Include send Warning where as Require send Fatal Error .

11


WHAT ARE THE DIFFERENCES BETWEEN GET AND POST METHODS ?

TOPS Technologies:http://www.topsint.com/php-training-course.html

There are some defference between GET and POST method 1. GET Method have some limit like only 2Kb data able to send for request But in POST method unlimited data can we send 2. when we use GET method requested data show in url but Not in POST method so POST method is good for send sensetive request

9/11/2013

•

12


WHAT IS HTACCESS? WHY DO WE USE THIS AND WHERE?

TOPS Technologies:http://www.topsint.com/php-training-course.html

htaccess files are configuration files of Apache Server which provide a way to make configuration changes on a perdirectory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.

9/11/2013

•

13


WHAT ARE THE DIFFERENCES BETWEEN PUBLIC, PRIVATE, PROTECTED,STATIC, TRANSIENT, FINAL AND VOLATILE ?

TOPS Technologies:http://www.topsint.com/php-training-course.html

Public: Public declared items can be accessed everywhere. Protected: Protected limits access to inherited and parent classes (and to the class that defines the item). Private: Private limits visibility only to the class that defines the item. Static: A static variable exists only in a local function scope, but it does not lose its value when program execution leaves this scope. Final: Final keyword prevents child classes from overriding a method by prefixing the definition with final. If the class itself is being defined final then it cannot be extended. transient: A transient variable is a variable that may not be serialized. volatile: a variable that might be concurrently modified by multiple threads should be declared volatile. Variables declared to be volatile will not be optimized by the compiler because their value can change at any time.

9/11/2013



14


WHAT ARE MAGIC METHODS?

TOPS Technologies:http://www.topsint.com/php-training-course.html

Magic methods are the members functions that is available to all the instance of class Magic methods always starts with "__". Eg. __construct All magic methods needs to be declared as public To use magic method they should be defined within the class or program scope Various Magic Methods used in PHP 5 are: __construct() __destruct() __set() __get() __call() __toString() __sleep() __wakeup() __isset() __unset() __autoload() __clone()

9/11/2013



15


FOR MORE VISIT US AT YOUR NEAREST CENTER. •

TOPS Technologies:http://www.topsint.com/php-training-course.html

http://www.tops-int.com http://www.tops-int.com/php-training-course.html

9/11/2013

16


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.