PHP Interview Question And Answare | PHP Interview Question And Answare for Fresher | Set 02

1.How many ways we can pass the variable through the navigation between the pages?
 Ans: At least 3 ways:
         1. Put the variable into session in the first page, and get it back from session in the next page.
         2. Put the variable into cookie in the first page, and get it back from the cookie in the next page.
         3. Put the variable into a hidden form field, and get it back from the form in the next page.

2.What’s the difference between md5(), crc32() and sha1() crypto on PHP?
 Ans: The major difference is the length of the hash generated. CRC32 is, evidently, 32 bits, while sha1() returns a 128 bit value, and md5() returns a 160 bit value. This is important when avoiding collisions.

3.What is the maximum length of a table name, a database name, or a field name in MySQL?
 Ans: Database name: 64 characters

         Table name: 64 characters

         Column name: 64 characters

4.How many values can the SET function of MySQL take?
 Ans: MySQL SET function can take zero or more values, but at the maximum it can take 64 values.

5.What are the other commands to know the structure of a table using MySQL commands except EXPLAIN command?
 Ans: DESCRIBE table_name;

6.How can we find the number of rows in a table using MySQL?
 Ans: Use this for MySQL

         SELECT COUNT(*) FROM table_name;

7.How many ways we can we find the current date using MySQL?
 Ans: SELECT CURDATE();
          SELECT CURRENT_DATE();
          SELECT CURTIME();
          SELECT CURRENT_TIME();

8.Give the syntax of GRANT commands?
 Ans: The generic syntax for GRANT is as following

          GRANT [rights] on [database] TO [username@hostname] IDENTIFIED BY [password]

         Now rights can be:
          a) ALL privilages
          b) Combination of CREATE, DROP, SELECT, INSERT, UPDATE and DELETE etc.

        We can grant rights on all databse by usingh *.* or some specific database by database.* or a specific table by database.table_name.

9.What are encryption functions in PHP?
 Ans: CRYPT()
          MD5()

10.What is the difference between htmlentities() and htmlspecialchars()?
 Ans: htmlspecialchars() - Convert some special characters to HTML entities (Only the most widely used)
        htmlentities() - Convert ALL special characters to HTML entities


Previous Next


:: Click the links below for similar type Questions and answers ::

Set 01 | Set 02  | Set 03  | Set 04  | Set 05  | Set 06  | Set 07  | Set 08  | Set 09 

0 comments:

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes