PHP Basic Knowledge Exercises

Source: Internet
Author: User
Tags echo d php server

1. What is PHP referring to? (C )

A.private Home Page

B.personal Hypertext Processor

C.php:hypertext Preprocessor

D.personal Home Page

2. What delimiter is the PHP server script surrounded by? C

A.<?php>...</?>

B.<script>...</script>

C.<?php ...? >

D.<&>...</&>

3. How do I use PHP to output "Hello World"?

A. " Hello World ";

B.echo "Hello World";

C.document.write ("Hello World");

4. In PHP, which symbol does all the variables begin with?

A.! b.& c.$

5. What is the correct way to end a PHP statement?

A.</php> b.new line C.; D..

6. Which of the following PHP syntax is most similar to?

A.vbscript b.javascript C.perl and C

7. How do I get data from a form that was submitted using the "Get" method?

a.$_get[];      b.request.querystring; C.request.form;

8. Please determine if the following statements are correct: When using the POST method, the variables are displayed in the URL. Error

9. Determine if the following statement is correct: in PHP, you can use either single quotation marks ("") or double quotation marks ("") to enclose the string. correct

10. Please determine if the following statement is correct: the include file must use the file suffix ". Inc". Error

11. What is the correct way to refer to the file "Time.inc"?

a.<?php require ("Time.inc");? >

b.<!--includefile= "Time.inc"-

C.<?phpinclude_file ("Time.inc");?>

d.<% include file= "Time.inc"%>

12. What is the correct way to create a function in PHP?

A.function myFunction ()

B.create myFunction ()

C.new_function myFunction ()

13. What is the correct way to open the file "Time.txt" in read-only mode?

A.fopen ("Time.txt", "r+"); ----This is read and write

B.open ("Time.txt");

C.open ("Time.txt", "read");

D.fopen ("Time.txt", "R");

14. Please determine if the following statements are correct:

PHP allows us to send emails directly via scripts. correct

15. What is the correct way to connect to a MySQL database?

A.mysql_open ("localhost");

B.mysql_connect ("localhost");

C.connect_mysql ("localhost");

D.dbopen ("localhost");

16. What is the correct way to add 1 to $count variable?

A.++count

B. $count + +;

c.count++;

D. $count =+1

17. In PHP, the correct way to add comments is?

a.<!--...-->

B.<comment>...</comment>

C.*\. \*

d./*...*/

18. Determine if the following statement is correct: PHP can run on Microsoft Windows IIS (Internet informationserver). correct

19. Please determine if the following statements are correct: in PHP 5, MySQL support is enabled by default. Error

20. Which of the following variable names is not legal?

A. $my _var B. $myVar c. $my-var

21. The source code for PHP is (A)

A. Open B. Closed C. Need to purchase D. Completely invisible.

22. The output Statement of PHP is ()

A Out.print B. Response.Write C. Echo D. scanf

23. The English word for the integer type in PHP's winning volume type is ()

A Boolean B. String C. Integer D. Float

24. The escape character of Php "backslash" is ()

A \ n B. \ r C. \ t D. \\

25. The PHP traversal array uses the ()

A Print B. foreach C. Echo D. scanf

26. PHP variables must be added () before the variable name is declared and used

A. $ B. C & D. #

27. The following program segment outputs the result as ()

<? $a =3

if ($a%2==0) echo "even";

else echo "odd";

?>

A Even B. Odd C. Composite D. Display Error

28. The following program outputs the result as ()

A 5050 B. 4950 C. 5100 D. 5049

<?

$b = 2;

for (; $b <=100; $b + +)

{$sum = $sum + $b;}

Echo$sum;

?>

29. Run the following program segment with the output as ()

<? $arr =array (3,5,7,9,6);

ECHO$ARR[3];

?>

A 3 B. 5 C. 7 D. 9

30. The PHP Custom function returns the internal value, using the return function ()

A printf B. MD5 C. Return D. function

31. Which of the following is not a markup style for PHP? ( )

A <?...?> B. <?php...?> C. <% ... %> D. <+ ... +>

32.   Which of the following annotation styles is a multi-line comment for PHP? ( )

A     ... B. /*... * /C.        #... d.!...!

33. The output statement used by PHP is ()

A Out.print B. Response.Write C. Echo D. scanf

34. The following program segment outputs the result as ()

<? $a =4

if ($a%2==1) echo "odd";

else echo "even";

?>

A. Even B. Odd C. Composite D. Display Error

35. The following program outputs the result as ()

A 5050 B. 4950 C. 5100 D. 5000

<?

$b = 1;

for (; $b <100; $b + +)

{$sum = $sum + $b;}

Echo$sum;

?>

PHP Basic Knowledge Exercises

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.