One PHP interview question-it is said that it was from a large company

Source: Internet
Author: User
One PHP interview question-it is said that it was from a large company

  1. $ Arr1 = array (
  2. '0' => array ('fid' => 1, 'tid' => 1, 'name' => 'name1 '),
  3. '1' => array ('fid' => 1, 'tid' => 2, 'name' => 'name2 '),
  4. '2' => array ('fid' => 1, 'tid' => 5, 'name' => 'name3 '),
  5. '3' => array ('fid' => 1, 'tid' => 7, 'name' => 'name4 '),
  6. '4' => array ('fid' => 3, 'tid' => 9, 'name' => 'name5 ')
  7. );
  8. $ Arr2 = array (
  9. '0' => array (
  10. '0' => array ('tid' => 1, 'name' => 'name1 '),
  11. '1' => array ('tid' => 2, 'name' => 'name2 '),
  12. '2' => array ('tid' => 5, 'name' => 'name3 '),
  13. '3' => array ('tid' => 7, 'name' => 'name4 ')
  14. ),
  15. '1' => array (
  16. '0' => array ('tid' => 9, 'name' => 'name5 ')
  17. )
  18. );

5. briefly describe the database design paradigm and application. Generally, the 3rd paradigm is enough to optimize the table structure. This can avoid the complexity of applications and the low system efficiency caused by too large SQL statements.

6. the Id in a table has multiple records. check all records of this id and display the total number of records. these records are implemented using SQL statements, views, and stored procedures.

  1. DELIMITER //

  2. Create procedure ProcGet
  3. (
  4. IN ID_a INT (11)
  5. )

  6. BEGIN

  7. Declare exit handler for sqlexception begin end;
  8. Select count (*) AS Sum FROM News Where ID = ID_a;
  9. END ;//

  10. CALL ProcGet (88 )//

7. The table contains three columns a B c, which are implemented using SQL statements: Select Column A if Column A is greater than Column B; otherwise, select column B, if Column B is greater than column C, column B is selected; otherwise, column C is selected.

  1. DELIMITER //

  2. Create procedure ProcOut ()
  3. BEGIN
  4. Declare exit handler for sqlexception begin end;
  5. DECLARE Sum_a INT (11 );
  6. DECLARE Sum_ B INT (11 );
  7. DECLARE Sum_c INT (11 );

  8. -- Obtain the total value of column A <--

  9. DECLARE cur_1 cursor for select sum (A) FROM table_name;
  10. OPEN cur_1;
  11. FETCH cur _ 1 INTO Sum_a;
  12. CLOSE cur_1;

  13. -- Obtain the total value in column B <--

  14. DECLARE cur_2 cursor for select sum (B) FROM table_name;
  15. OPEN cur_2;
  16. FETCH cur _ 2 INTO Sum_ B;
  17. CLOSE cur_2;

  18. -- Obtain the total value in column C <--

  19. DECLARE cur_3 cursor for select sum (C) FROM table_name;
  20. OPEN cur_3;
  21. FETCH cur _ 3 INTO Sum_c;
  22. CLOSE cur_3;

  23. IF Sum_a> Sum_ B THEN

  24. Select a from table_name;

  25. ELSEIF Sum_ B> Sum_c THEN

  26. Select B FROM table_name;

  27. ELSE

  28. Select c from table_name;
  29. End if ;;
  30. END ;//

  31. CALL ProcOut ()//

8. briefly describe how to optimize the SQL statement execution efficiency in the project. In what ways can we analyze the SQL statement performance? 9. if the template is a smarty template. How to use the section Statement to display an array named $ data. For example:

  1. $ Data = array (
  2. [0] => array ([id] = 8 [name] = 'name1 ')
  3. [1] => array ([id] = 10 [name] = 'name2 ')
  4. [2] => array ([id] = 15 [name] = 'name3 ')
  5. ......
  6. )

Write the code on the template page? How can I display it with the foreach statement?

10. write a function to traverse all files and subfolders in a folder. (Directory Operations)

11. two city and province tables. These are the relationship tables between cities and provinces.

City: id City Provinceid1 Guangzhou 12 Shenzhen 13 Huizhou 14 Changsha 25 Wuhan 3 .......... Guangzhou province: id Province1 Guangdong 2 Hunan 3 Hubei ..........

(1) Write an SQL statement to link two tables. implementation: display the basic information of the city .? (2) display field: City id, city name, and province. For example, Id (City id) Cityname (city name) Privence (province )....

(2) If you want to count the number of cities in each province, use group by to query them .? Display field: province id, province name, and number of cities.

12. based on your experience, briefly describe the steps for software development in software engineering. What are the disadvantages of the following tools used by Rational Rose, PowerDesigner, Project, VSS, CVS, and TestDirector? 13. briefly describe the difference between the operating system thread and process. List the software you have used in LINUX? 14. Use a pseudo-language combined with the data structure bubble sorting method to sort the following data groups 10 2 36 14 10 25 23 85 99 45.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.