January 22, 2019

Srikaanth

Infosys PHP Recent Technical Interview Questions And Answers

1. What is the difference between ID and class in CSS?

The difference between an ID and Class is that an ID can be used to identify one element, whereas a class can be used to identify more than one.

2. What is the difference between sql and Mysql?

SQL or Structured Query Language is a programming language designed for managing data held in a Relational Database Management System. Mysql is a open source, relational database management System.

Infosys PHP Technical Interview Questions And Answers
Infosys PHP Technical Interview Questions And Answers
3. Why do we use GROUP BY and ORDER BY function in mysql?

Group By is used for retrieving information about a group of data. It is generally used with some aggregate function like SUM, AVG etc.

ORDER BY is used to sort the records using column name. It can sort column in both ascending and descending order.

4. What is JOIN in mysql? What are the different types of join?

When we have to fetch records from more than one table we can use JOIN keyword. The process is known as joining the tables.

There are various types of join like

INNER JOIN, LEFT JOIN, RIGHT JOIN, and OUTER JOIN.

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

Both are used to split a string to array, the basic difference is that split() uses pattern for splitting and explode() uses a string. explode() is faster than split() as it does not match the string based on regular expression.  Also split() is deprecated as of 5.3.0. So using of this function is discouraged.

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

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

8.  What is the main difference between require() and require_once()?

require() and require_once() perform the same task except that the second function checks if the PHP script is already included or not before executing it.

(same for include_once() and include())

9.  How can we display information of a variable and readable by human with PHP?

To be able to display a human-readable result we use print_r().

10.  How is it possible to set an infinite execution time for PHP script?

The set_time_limit(0) added at the beginning of a script sets to infinite the time of execution to not have the PHP error ‘maximum execution time exceeded’.It is also possible to specify this in the php.ini file.

11.  How can we access the data sent through the URL with the GET method?

In order to access the data sent via the GET method, we you use $_GET array like this:

www.url.com?var=value
$variable = $_GET[“var”]; this will now contain ‘value’

12.  How can we access the data sent through the URL with the POST method?

To access the data sent this way, you use the $_POST array.

Imagine you have a form field called ‘var’ on the form, when the user clicks submit to the post form, you can then access the value like this:

$_POST[“var”];

13.  How is it possible to remove escape characters from a string?

The stripslashes function enables us to remove the escape characters before apostrophes in a string.

14.  How can we automatically escape incoming data?

We have to enable the Magic quotes entry in the configuration file of PHP.

15.  What does the function get_magic_quotes_gpc() means?

The function get_magic_quotes_gpc() tells us whether the magic quotes is switched on or no.


Subscribe to get more Posts :