Php question summary (with reference answers) _ PHP Tutorial

Source: Internet
Author: User
Tags echo b php operator
Php question summary (with reference answers ). The predecessor of 1JavaScript scripting language is BA. basicB. liveScriptC. oakD. VBScript2 uses CSS to modify the text. if the text flashes, the value of text-decoration is DA. noneB. the predecessor of underline 1 JavaScript scripting language is B.

A. Basic

B. Live Script

C. Oak

D. VBScript

2. use CSS to modify the text. if the text flashes, the value of text-decoration is D.

A. none B. underline C. overline D. blink

3. the XML-based standard is C.

A. html B. MIME C. SGML D. CGI

4. Mark B is placed between Mark B.

A.html and html

B. head and head

C. body and body

D. head and body

5. the parameter connecting the image in the tag is B.

A. href B. src C. type D. align

The extension of the 6-level Cascading Style Sheet file is B.

A html Bcss C xml D dib

7. compared with previous versions, HTML4.0: C

A added JavaScript support

B adds Flash technology

C enhances the dynamic nature of web pages

D. added ActiveX technology.

8. mark in HTML

B

A. Title Mark B. Pre-layout Mark C. line Mark D. text effect mark

9 in HTML, the line label is B.

A.html B. br C. title D. p

10 in HTML, the title font is marked The maximum value of x in is C.

A.4 B .5 C.6 D.1

11 Which of the following does not belong to the data definition language?

A. select

B. create

C. drop

D. alter

13 which of the following statements about the return value of mysql_select_db is true? C

A. If it is enabled successfully, 1 is returned. if it fails, 0 is returned.

B. If it is enabled successfully, a connection id is returned. if it fails, false is returned.

C. If it is enabled successfully, True is returned. if it fails, False is returned.

D. If Cheng Shi is enabled, True is returned, and an error code is returned for failure.

14. check the code. which Connection ID will the database close command close? B

$ Link1 = mysql_connect ("localhost", "root ","");

$ Link2 = mysql_connect ("localhost", "root ","");

Mysql_close ();

?>

A. $ link1

B. $ link2

C. close all

D. Error

15 which operation does mysql_affected_rows () affect? A

A. select

B. delete

C. update

D. insert

16 in the mysql_data_seek (query result Pointer, data record location) function, how many data record locations start? D

A. 1

B. 2

C. 3

D. 0

17 the function for getting the total number of records in the result set of the search statement is: C

A. mysql_fetch_row

B. mysql_rowid

C. mysql_num_rows

D. mysql_fetch_array

18 which of the following statements about mysql_pconnect is true? D

A. multi-connection with the database

B. The function is the same as that of mysql_connect.

C. same as @ mysql_connect

D. establish a persistent connection with the database

19 What functions should I use to obtain the running status of the mysql database system? C

A. mysql_ping

B. mysql_status

C. mysql_stat

D. mysql_info

20 The role of the mysql_insert_id () function is: B

A. view the ID number of the next insert record

B. view the inserted auto-increment ID.

C. check the total number of insert operations performed

D. view the total number of records

21 which of the following is the correct type of mysql_ping () function and return value? D

A. check the status of the database system and return an integer value.

B. check the status of the database system. the returned value is Boolean.

C. check whether the connection to the server is normal. an integer value is returned.

D. check whether the connection to the server is normal. The return value is Boolean.

22. a cart. inc contains the add_item method ),

Which of the following options can be used correctly? add_item

ClassCart {

Var $ items;

Functionadd_item ($ artnr, $ num ){

$ This-> items [$ artnr] + = $ num;

}

}

?>

A.

Require ("cart. inc ");

$ Cart = new Cart;

$ Cart-> add_item ("10", 1 );

?>

B.

Require (cart. inc );

$ Cart = new Cart

$ Cart-> add_item ("10", 1)

?>

C.

Require ("cart. inc ");

$ Cart = new Cart ();

$ Cart-> add_item ("10", 1 );

?>

D.

Include ("cart. inc ");

$ Cart = new Cart ();

$ Cart-> add_item ("10", 1 );

?>

23 which of the following statements about mysql_db_query and mysql_query are true? C

A. The Returned values of mysql_db_query and mysql_query are the same after the SQL statement is executed. the resource number is returned successfully, and FALSE is returned if the SQL statement fails.

B. The mysql_query function cannot be used to temporarily execute SQL statements in another database, while mysql_db_query can

C. mysql_db_query will not switch back to the database previously connected

D. mysql_query is functionally equivalent to mysql_select_db () + mysql_db_query ()

24. code execution result A below

Mysql_connect ("localhost", "root ","")

$ Result = mysql_query ("select id, name from tb1 ");

While ($ row = mysql_fetch_array ($ result, MYSQL_ASSOC ))

{Echo "ID:". $ row [0]. "Name:". $ row [];}

?>

A. error

B. print only the first record

C. print all records with loop line breaks

D. no results

25. The difference between mysql_connect () and @ mysql_connect () is () B

A @ mysql_connect () will not ignore the error and display the error to the client

B mysql_connect () will not ignore the error and display the error to the client

C no difference

D. Two functions with different functions

26. statement for ($ k = 0; $ k = 1; $ k ++); and Statement for ($ k = 0; $ k = 1; $ k ++ ); the number of executions is:

A and 0

B 0 and unlimited

C is infinite

All D values are 0.

27. the method for reading the value of the form element passed by the post method is: B

A $ _ post ["name"]

B $ _ POST ["name"]

C $ post ["name"]

D $ POST ["name"]

28. in the php operator, the priority ranges from high to low () D

A relational operator, logical operator, arithmetic operator

B arithmetic operators, relational operators, logical operators

C logical operators, arithmetic operators, relational operators

D relational operators, arithmetic operators, logical operators

29. the cookie value is stored in () C

Hard disk

Program B

C client

D server side

30. to view the data type of a variable, use function () B.

A type ()

B gettype ()

C GetType ()

D Type ()

31. the comparison of strings is. B

A pinyin sequence

B ASCII code value

C random

D sequential

32. the type attribute value of the check box is ()

A checkbox

B radio

C select

D check

33. the SESSION value is stored in () D

Hard disk

B webpage

C client

D server side

34. which function () A should be used to obtain the information of the latest query?

A mysql_info

B mysql_stat

C mysql_insert_id ()

D mysql_free_result

35. to view the value of a variable of the structure type, use function () B.

A Print ()

B print ()

C Print_r ()

D print_r ()

36. which variable array in PHP always contains cookies sent by all clients () B

A $ _ COOKIE

B $ _ COOKIES

C $ _ GETCOOKIE

D $ _ GETCOOKIES

37. Which of the following statements is false? () B

A gettype () is used to view the data type.

The variable that B is not assigned is 0.

C unset () is considered NULL

D. The most important aspect of a double quotation mark string is that the variable name will be replaced by the variable value.

38. the Function of strtolower () is ().

A converts all the given strings to lowercase letters.

B converts all the given strings to uppercase letters.

C. convert the initial character string into lowercase letters.

D. convert the first letter of a given string to an uppercase letter.

39. in HTML, the "value" of the table cell is stored in the () label B.

A response body>

B. td>

C branch tr>

D external table>

40. the Function for converting a value or variable to a character type is () B

A intval ()

B strval ()

C str

D valint ()

41. the concatenation operator of strings in php is () D

A-

B +

C &

D.

42. php functions do not support the following functions: C

A variable parameter count

B. pass parameters by reference

C passing parameters through pointers

D. implement recursive functions

43. the type attribute value of the file box is ()

A text

B hidden

C textarea

D checkbox

44. The role of the operator "^" is () C

A is invalid.

Multiplication party B

C-bit non-

D-bit XOR

45. in a custom function, the keyword of the returned function value is () C.

A returns

B close

C return

D back

46. to check whether a constant is defined, you can use function () C

A defined ()

B isdefin ()

C isdefined ()

D n/

47. Which of the following statements about the role of mysql_select_db is true? () D

A. connect to the database

B. connect to and select a database

C. connect to and open the database

D. select a database

48. where is the title tag in HTML? B

In the body tag

In the B head Label

In the C script tag

In the D table label

49. use the () function to obtain the array size.

A count ()

B conut ()

C $ _ COUNT ["name"]

D $ _ CONUT ["name"]

50. you can use the () function to delete data from the queue head. A

A array_push ()

B array_pop ()

C array_shift ()

D array_unshift ()

51. embed javaScript in html. the mark that should be used is ()

A required script language = "javascript">

B branch head> branch/head>

C. body> response/body>

D success ⟨! --... //...>

52. the following code runs the result () D

$ A = array ("Monday", "Tuesday", 3 => "Wednesday ");

Echo $ A [2];

A Monday

B Tuesday

C Wednesday

D not displayed

53. the function for creating an array is ().

A array

B next

C count

D reset

54. the following incorrect variable names are () B

A $ _ test

B $ 2abc

C $ Var

D $ printr

55. the method for reading the value of the form element passed by the get method is as follows:

A $ _ GET ["name"]

B $ get ["name"]

C $ GEG ["name"]

D $ _ get ["name"]

56. the significance of the vat_dump function is () C

A defines an array

B. traverse the array.

C. output variable information

D recursive array

57. the strtoupper () function has the following functions:

A converts all the given strings to uppercase letters.

B converts all the given strings to lowercase letters.

C converts the first letter of a given string to an uppercase letter.

D. convert the first letter of a given string to a lowercase letter.

58. the running result of the following code is () B

If ($ I = "")

{Echo "";}

Else

{Echo "B ";

}

?>

A outputs

B output B

The C condition is insufficient and cannot be determined.

D running error

59. in the str_replace (, 3) function, 1 2 3 represents () B.

A "replace string", "Replace string", "source string"

B "replaced string", "replaced string", "source string"

C "source string", "Replace string", "Replace string"

D "source string", "replaced string", "replaced string"

60. what part of HTML is displayed when you browse the webpage? C

A title

B table

C body

D head

61. The role of the operator "%" is () C

A is invalid.

B rounded up

C. remainder extraction

Division D

62. The data type returned by the file () function is () B.

Array

B string

C integer

D. depends on the file.

63. Assume $ a = 5 and $ a + = 2, then the value of $ a is C.

A. 5 B. 6 C. 7 D. 8

64. Which of the following statements about MYSQL is false?

A. MYSQL is A real multi-threaded, single-user database system.

B. MYSQL truly supports multiple platforms

C. MYSQL fully supports ODBC

D. MYSQL can mix tables from different databases in one operation.

65. B is a comparison operator in PHP.

A. = B .! C. = D .&

66. the PHP method for defining activity variables is B.

A. var B. $ C. $ D .&

67. if the PHP expression $ foo = 1 + "bob3", the value of $ foo is.

A. 1 B. 1bob3 C. 1b D.92

68. PHP bitwise operators do not include D

A. & B. | C .~ D .!

69. Which of the following statements about PHP variables is true? D

A. PHP is A strong language

B. When declaring a PHP variable, you must specify the variable type.

C. when declaring a PHP variable, the character used before the variable name is "&"

D. when a PHP variable is used, the context automatically determines its variable type.

70. the ID of the entered HTML document in PHP is D.

A." "End

B. use" "End

C. start with "<%-" and end with "-%>"

D. use" "End

71. in PHP syntax, if $ a = "hello", $ B = "china" is known, how to operate C to obtain the "hello china" string?

A. $ a + $ B B. $ a-$ B C. $ a. $ B D. $ a + = $ B

72. to configure the PHP environment, you only need to modify

A. php. ini B. http. conf C. php. sys D. php.exe

73. Which of the following commands is not the PHP output command? D

A. echo B. printf () C. print D. write

74. the method for defining constants in PHP is C.

A. var B. dim C. define () D. undefined ()

75. the following PHP statement segments are available:

If ($)

Print "true ";

Else

Print "false ";

?>

To output "false", $ a should be D

A. 10 B.-3 C. "true" D. "0"

76. if $ g = 14 is known, the PHP expression $ h = $ g + = 10 is returned.

A. $ h = $ g = 24 B. $ h = 10, $ g = 24 C. $ h = 10. $ g = 14 D. $ h = 24, $ g = 10

77. the operator used to call a method or attribute of an object in PHP is B.

A. => B.-> C. D .~

78. Suppose $ a = 5 and $ B = ($ a --), then $ B is B.

A. 4 B. 5 C, 6 D. 0

79. mark
The purpose is B.

A. Segment command B. line feed command C. end command D. Print command

80. the function used to delete the current directory in PHP is: D

A. chdir B. cd C. opendir D. rmdir

Second major block, programming question (10 points for each question total 20 points)

1. use PHP to implement a user login program. The user table structure in database TEST is as follows:

User (userid char (8), password char (6 ))

// The pseudocode is as follows:

$ Link = mysql_connect ("$ dbhost", "$ dbusername", "$ dbpassword"); // connect to the database

Mysql_select_db ("$ dbname ");

// Write an SQL statement

$ SQL = "select ...";

$ Resource = mysql_query ($ SQL, $ link );

If (mysql_fetch_row ($ resource )){

Echo "Congratulations on your successful login ";

} Else {

Echo "this user does not exist ";

}

2. in MYSQL, the student table content in the database "study" is as follows:

Id name sex

9701 Wang male

9702 Zhang male

9703 li female

The database connection server parameters are: ("localhost", "root", "1234 ")

Please use PHP to compile a program to delete a data record with id 9701

$ Link = mysql_connect ("localhost", "root", "1234"); // connect to the database

Mysql_select_db ("study ");

// Write an SQL statement

$ SQL = "delete from stuindent where id = 9701 ";

$ Boolean = mysql_query ($ SQL, $ link );

If ($ boolean ){

Echo "deleted successfully ";

} Else {

Echo "failed to delete ";

}

?>

4. write the following program running results and write the general process (10 points)

Class test {

Var $ a, $ B;

Function test ($ a, $ B ){

$ This-> a = $;

$ This-> B = $ B;

}

Function getA (){

Return $ this->;

}

Function getB (){

Return $ this-> B;

}

Function xprint (){

Echo "a =". $ this-> a. "B =". $ this-> B;

}

};

Class test1 extends test {

Var $ c, $ d;

Function test1 ($ a, $ B, $ c, $ d ){

$ This-> a = $;

$ This-> B = $ B;

$ This-> c = $ c;

$ This-> d = $ d;

}

Function getC (){

Return $ this-> c;

}

Function getD (){

Return $ this-> d;

}

Function xprint (){

Echo "a = ". $ this->. "B = ". $ this-> B. "c = ". $ this-> c. "d = ". $ this-> d;

}

};

$ X = new test (0, 0 );

$ X-> xprint ();

Echo"
\ N ";

$ Y = new test1 (1, 2, 3, 4 );

$ Y-> xprint ();

?>

A = 0 B = 0

A = 1 B = 2 c = 3 d = 4

The predecessor of http://www.bkjia.com/PHPjc/478537.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478537.htmlTechArticle1 JavaScript scripting language is B. basic B. live Script C. oak D. VBScript 2 uses CSS to modify the text. if the text flashes, the value of text-decoration is d. none B. underline...

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.