Showing posts with label PHP Interview QA. Show all posts
Showing posts with label PHP Interview QA. Show all posts

Thursday, 25 September 2014

Interview QA in PHP

1. What is the REGEXP?

A REGEXP pattern match succeed if the pattern matches anywhere in the value being tested.

2. What is the difference between BLOB AND TEXT?

A BLOB is a binary large object that can hold a variable amount of data. The four BLOB types TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB differ only in the maximum length of the values they can hold.
The four TEXT types TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT correspond to the four BLOB types and have the same maximum lengths and storage requirements. The only difference between BLOB and TEXT types is that sorting and comparison is performed in case-sensitive fashion for BLOB values and case-insensitive fashion for TEXT values. In other words, a TEXT is a case-insensitive BLOB.

3. How would you change a table to InnoDB?

ALTER TABLE name_file ENGINE innodb;

4. What Is a Session?

Ans.It can be used to store information on the server for future use.

5. what is difference between primary key and candidate key?

Primary Key
– are used to uniquely identify each row of the table. A table can have only one primary Key.
Candidate Key
– primary key is a candidate key. There is no difference. By common convention one candidate key is designated as a primary one and that key is used for any foreign key references.

Interview Question and Answer

Q1. Who is the Father of PHP?

Ans. Rasmus Lerdorf

Q2. What is PHP stands for?

Ans. Hyper text Pre Processor

Q3. What is PHP?

Ans. The PHP is a Hypertext Pre-processor and is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications.

Q4. Which programming language does PHP resemble to?

Ans. PHP resemble to pearl and C

Q5. How can we create a database using PHP and MySQL?

Ans. We can create MySQL database with the use of
mysql_create_db ("Database Name")

Q6. Difference between include and require functions?

Ans:Both these functions differ in how they handle failures that occur. Suppose a file is not found by the include() function, then it will simply give a warning and script execution will not be interrupted. However, if a file is not found using a require() function, it will throw up a fatal warning and stop the script execution.

Q7. What is a CAPTCHA & when do you use it?

Ans: CAPTCHA is the short form of Completely Automated Public Turing Test. It‟s a step taken to ensure that a feature is not abused in a way it‟s not meant to be used. We use CAPTCHAS for general form submissions, registrations, user generated content and so on to prevent spam bots from clogging up the system or spamming.

Q8. How many times is it possible to use an include function in a PHP page?

Ans:We can use include function multiple times in any dynamically generated PHP page. However, it‟s not considered a good practice to have multiple include functions on the same page.

Q9. What is an efficient way to combine two variables in PHP?

Ans:There are two different ways to combine variables in PHP. Let‟s take an example.
  • $var1 = „Hello „;
  • $var2 = „World‟;
We can combine it using the two codes below
  • $var 3 = $var1.$var2; and
  • $var3 = “$var1$var2″;
It‟s usually seen that, for large datasets, the first method outperforms the second one.

Q10. What is the difference between GET and POST functions?

Ans:GET function is normally used when the result of using this function does not cause any visible change on the state of the world. This is normally used in cases like searching from a database where no changes are made to the system.

POST function is used when there is a visible change on the state of the world. When we use a POST function,  normally the system changes. E.g. when we add, delete or modify values from a database. A simple example is a form submission.