PHP Pen Exam question 2

Source: Internet
Author: User
Tags php source code
PHP Pen Question 2

PHP Pen Question 2
April 24, 2011
   say in front:
1, the following topics, in addition to programming tasks need to be written on the papyrus provided to you. Paper is precious Earth resources, please save the use. Programming tasks in the corresponding environment, will require the computer to write, there is no conditions, it can only be written on the papyrus.
2. Time:
Basic Task + Advanced task + Design task = 90 minutes
Programming task = 60 Minutes
   Basic tasks:
1. Please list the UNIX signals you can think of and indicate the purpose of the signal.
2, please list, you can think of all the string lookup algorithm, and annotated simple description.
3. There is an IP address (192.168.0.1), please write out its 32-bit unsigned integer form.
4, write, you can think of all the HTTP return status value, and explain the purpose (for example: return 404 means the page cannot be found)
   Basic Tasks - Select (will get extra points):
1, draw a few of your most familiar server-side model out (the format is not important, try to clear the picture, explain the idea can be)
   Advanced tasks:
1. What is the garbage collection mechanism of PHP?
Description
1) If you are familiar with PHP source code, then please start from the source, answer some questions, you will get extra points
2) If you are not familiar with PHP source code, then do your best, write more things, including the use of their own programming intuition to get information, can be.
3) Yes, then there are points, mistakes do not buckle, do not write no points.
2. Please write out the HTTP headers and meet the following requirements:
1) This is a POST request
2) Target: http://www.example.com:8080/test
3) Post variables:
Username:test
Pwd:test2
Intro:hello world!
4) contains the following cookie information:
Cur_query:you&me
Description
1) If you do not remember the instruction word in an HTTP protocol, then this is replaced with "kanji".
2) If you can remember more HTTP protocol instruction words, then write a few more words, always no harm, right?
3) Most critical, just draw the correct "contour" (remember HttpWatch and other tools to print out the head?). That is the meaning of "contour", there will be scores, but if, even the "outline" are written wrong, then it is regrettable.
   Design tasks:
1. There have been a few recent harassment of our voting module, which requires you to design a voting limit.
Requirements are as follows:
1) require each QQ number (assuming this QQ number in UNIT32 can be expressed) 10 minutes this can only vote 5.
2) Our users are very enthusiastic, an average of 20 million people a day to vote through this program.
Description
1) No need to write code, just the picture and text.
2) for the key logic, please use the graph plus code to express, this is also a test of your ability to express your words.
3) Make a list of all the boundary conditions you can think of, and this is the test of your logical thinking in general and agility.
4) Storage section, do what you can. If you need a storage layer of your own design, then the implementation of this storage layer, with the text + picture to describe clearly, if the design is reasonable, you will get gorgeous award points.
   Programming tasks:
1, we encountered a trouble, a new missionary annoyed God, God is angry, asked us to memorize the Bible (bbe.txt), until he said which word, we will quickly answer the word in the first few words of the word position. I heard that you are a good programmer, so 髟 help us to accomplish this impossible task.
Requirements are as follows:
1)/myworks/example/bbe.txt,98 version of the English Bible
2) The input section requires the following: PHP./example.php [Words]
3) The output section is as follows: [Word] 2,4 5,6 said: This word in 1 rows 2 columns (the second word), 2 rows 4 columns ...
Description
1) This text 4MB of giant ...
2) Meaning of the word: a string consisting of an English letter (case), a number (0-9)
3) provided to your machine OS for Ubuntu 9.10, memory only 1 g, and, unfortunately, where 700M was used to do something else
4) The computer does not allow the Internet, but I installed the man document and read the CHM and PDF reader, in the desktop CHM folder in the PC, there is a corresponding PHP reference manual
5) algorithm complexity requirements cannot be greater than O (n^2) (N squared)
6) What? PHP is inefficient and easy to use, so you can do it in a different language. But note: Available to you on the machine only Python 2.4/perl 5.8/gcc[g++] 4.1
=============
1. In PHP, the name of the current script (not including the path and query string) is recorded in the predefined variable (1), while the URL linked to the current page is recorded in the predefined variable (2).
2. The execution of the program segment outputs (3).
3. In HTTP 1.0, the meaning of status code 401 is (4); If you return a prompt for "file not found", the header function is available with the statement (5).
4. The function of array function Arsort is (6); the function of statement error_reporting (2047) is (7).
The database connection string format in 5.PEAR is (8).
6. Write a regular expression that js/vbs all the scripts on the Web page (that is, remove the tags and their contents): (9).
7. Install PHP in the Apache module, and in the file http.conf, the PHP module should be loaded dynamically with the statement (10).
Then use the statement (11) so that Apache will all files with the extension PHP as PHP script processing.
8. Statements include and require can include another file in the current file, the difference is (12), in order to avoid multiple inclusion of the same file, you can use the statement (13) instead of them.
9. The properties of the class can be serialized and saved to the session so that the entire class can be restored later, and the function to be used is (14).
10. The argument of a function cannot be a reference to a variable unless (15) is set to on in PHP.ini.
The meaning of the left join in 11.SQL is (16).
If Tbl_user records the student's name and school Number (ID),
Tbl_score recorded student (ID) and test scores (score) and test subjects (subject), which were expelled from the school after the exam,
To print out each student's name and the corresponding total, the SQL statement (17) can be used.
12. In PHP, Heredoc is a special string, and its end flag must be (18).
13. Write a function that can traverse all the files and subfolders under a folder.
14. Briefly describe the implementation principle of infinite classification in the forum.
15. Design a Web page so that it pops up a full-screen window with a text box and a button. The user clicks the button to close the window while entering the information in the text box, and the input information is displayed on the main page.
Answer (fill in the blanks):
1. Echo $_server["Php_self"; echo $_server["Http_referer"];
2.0
3. (4) Unauthorized (5) header ("http/1.0 404 Not Found");
4. (6) Reverse-order the array and keep the index relationship (7) all errors and warnings
5. I didn't get it.
6./].*?>.*?/si
7. (LoadModule) php5_module "D:/xampp/apache/bin/php5apache2.dll"
(one) AddType application/x-httpd-php-source. Phps
AddType application/x-httpd-php. php. php5. PhP4. php3. phtml
8. (12) When an exception occurs, the include generates a warning require a fatal error (require_once ()/include_once ()
9. Serialize ()/unserialize ()
Ten. Allow_call_time_pass_reference
11. (16) Natural left outer connection
Select Name, count (score) as Sum_score from Tbl_user left join Tbl_score on Tbl_user.id=tbl_score.id GROUP by Tbl_us Er.id
12. The line where the end identifier is located cannot contain any other characters except ";"
13.
/**
* Traversing the directory, the result is stored in an array. Support PHP4 and above. PHP5 can replace the while loop with the Scandir () function later.
* @param string $dir
* @return Array
*/
My_scandir ($dir)
{
$files = Array ();
if ($handle = Opendir ($dir))
{
while (($file = Readdir ($handle))!== false)
{
if ($file! = ":" && $file! = ".")
{
if (Is_dir ($dir. "/" . $file))
{
$files [$file] = Rec_scandir ($dir. "/" . $file);
}
Else
{
$files [] = $file;
}
}
}
Closedir ($handle);
return $files;
}
}
  • 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.