Monday 30 April 2012

PHP Interview questions 17


66) Explain Normalization concept?
Ans : The normalization process involves getting our data to conform to three progressive normal forms, and a higher level of normalization cannot be achieved until the previous levels have been achieved (there are actually five normal forms, but the last two are mainly academic and will not be discussed).First Normal FormThe First Normal Form (or 1NF) involves removal of redundant data
from horizontal rows. We want to ensure that there is no duplication of data in a given row, and that every column stores the least amount of information possible (making the field atomic).Second Normal FormWhere the First Normal Form deals with redundancy of data across a horizontal row, Second Normal Form (or 2NF) deals with redundancy of data in vertical columns. As stated earlier, the normal forms are progressive, so to achieve Second Normal Form, your tables must already be in First Normal Form.Third Normal Form I have a confession to make; I do not often use Third Normal Form. In Third Normal Form we are looking for data in our tables that is not fully dependant on the primary key, but dependant on another value in the table            

67) How can we find the number of rows in a table using MySQL?
Ans :      Use this for mysql
>SELECT COUNT(*) FROM table_name;

68) How can we find the number of rows in a result set using PHP?
Ans :      $result = mysql_query($sql, $db_link);
$num_rows = mysql_num_rows($result);
echo "$num_rows rows found";

69) How many ways we can we find the current date using MySQL?
Ans : 69                SELECT CURDATE();
CURRENT_DATE() = CURDATE()
for time use
SELECT CURTIME();
CURRENT_TIME() = CURTIME()

70) What are the advantages and disadvantages of Cascading Style Sheets?
Ans : External Style SheetsAdvantagesCan control styles for multiple documents at once. Classes can be
created for use on multiple HTML element types in many documents. Selector and grouping methods can be used to apply styles under complex contextsDisadvantagesAn extra download is required to import style information for each document The rendering of the document may be delayed until the external style sheet is loaded Becomes slightly unwieldy for small quantities of style definitionsEmbedded Style Sheets Advantages Classes can be created for use on multiple tag types in the document.
Selector and grouping methods can be used to apply styles under complex contexts. No additional downloads necessary to receive style information
Disadvantages
This method can not control styles for multiple documents at once Inline Styles
Advantages
Useful for small quantities of style definitions. Can override other style specification methods at the local level so only exceptions need to be listed in conjunction with other style methods
Disadvantages
Does not distance style information from content (a main goal of SGML/HTML). Can not control styles for multiple documents at once.
Author can not create or control classes of elements to control multiple element types within the document. Selector grouping methods can not be used to create complex element addressing scenarios

No comments:

Post a Comment