Php Interview Questions and Answers

Php Interview Questions and Answers – Part 8

Php Interview Questions and Answers – Part 8

1- Give the syntax of REVOKE commands?
The generic syntax for revoke is as following

REVOKE [rights] on [database] FROM [username@hostname]

Now rights can be:

a) ALL privileges

b) Combination of CREATE, DROP, SELECT, INSERT, UPDATE and DELETE etc.

We can grant rights on all database by using *.* or some specific database by database.* or a specific table by database.table_name.
2- What is the difference between CHAR and VARCHAR data types?
CHAR is a fixed length data type. CHAR(n) will take n characters of storage even if you enter less than n characters to that column. For example, “Hello!” will be stored as “Hello! ” in CHAR(10) column.

VARCHAR is a variable length data type. VARCHAR(n) will take only the required storage for the actual number of characters entered to that column. For example, “Hello!” will be stored as “Hello!” in VARCHAR(10) column.
3- How can we encrypt and decrypt a data present in a mysql table using mysql?
AES_ENCRYPT() and AES_DECRYPT()
4- Will comparison of string “10″ and integer 11 work in PHP?
Yes, internally PHP will cast everything to the integer type, so numbers 10 and 11 will be compared.
5- What is the functionality of MD5 function in PHP?
string md5(string)

It calculates the MD5 hash of a string. The hash is a 32-character hexadecimal number.
6- How can I load data from a text file into a table?
The MySQL provides a LOAD DATA INFILE command. You can load data from a file. Great tool but you need to make sure that:

a) Data must be delimited

b) Data fields must match table columns correctly
7- What is meant by MIME?
Answer 1:

MIME is Multipurpose Internet Mail Extensions is an Internet standard for the format of e-mail. However browsers also uses MIME standard to transmit files. MIME has a header which is added to a beginning of the data. When browser sees such header it shows the data as it would be a file (for example image)

Some examples of MIME types:

audio/x-ms-wmp

image/png

application/x-shockwave-flash

Answer 2:

Multipurpose Internet Mail Extensions.

WWW’s ability to recognize and handle files of different types is largely dependent on the use of the MIME (Multipurpose Internet Mail Extensions) standard. The standard provides for a system of registration of file types with information about the applications needed to process them. This information is incorporated into Web server and browser software, and enables the automatic recognition and display of registered file types. …

 

Related Posts


Leave a Reply

Your email address will not be published. Required fields are marked *


*