PHP basic knowledge test questions and analysis, php basic knowledge test questions
A total of 40 multiple-choice questions and 10 secondary questions are asked. The exam takes one and a half hours.
I. multiple choice questions (single choice, 2 points per question ):
1. The specific LAMP structure does not contain the following ()
A: Windows
B: Apache server
C: MySQL database
D: PHP language
2. Which of the following SQL statements is correct? (D)
A: insert into users values ('p001', 'zhang san', 'mal ');
B: create table Name (Code int primary key );
C: update users set Code = 'p002' where Code = 'p001 ';
D: select Code as 'codeny' from users;
3. Which of the following is the correct description of the Bbrower/S web page program architecture? (C)
C/S client program
A: You need to install the client.
B: some web pages can be installed without installation.
C: a browser-based Network System
D: servers are required for systems that do not need servers.
4. Which statement in php can output variable type (c)
A: echo string
B: print
C: var_dump ()
D: print_r () print the Array
5. Which of the following statements is true for php variables? (B)
A: var a = 5;
B: $ a = 10;
C: int B = 6;
D: var $ a = 12;
6. Which of the following is the correct difference between single quotes and double quotes in php? (D)
A: single quotes are fast and double quotes are slow.
B: Double quotation marks are fast and single quotation marks are slow.
C: escape characters can be parsed in single quotes.
D: variables can be parsed in double quotes.
7. If x and y are integer data, the $ y result of the following statement is (B)
$ X = 1;
++ $ X;
$ Y = $ x ++;
A: 1 B: 2 C: 3 D: 0
$ X = 1;
$ Y = ++ $ x;
8. Which of the following statements about string processing functions in php is true? (c)
A: The implode () method can split the string into arrays and combine them.
B: str_replace () can replace string search and replacement at the specified position
C: substr () can intercept strings.
D: strlen () cannot get the length of the string
9. The following code runs as follows: ()
<? Php
$ First = "This course is very easy! ";
$ Second = explode ("", $ first );
$ First = implode (",", $ second );
Echo $ first;
?>
A This, course, is, very, easy ,!
B This course is very easy!
C This course is very easy !,
D. error message
10. The following functions should be used at the horizontal line of the program: (B)
<? Php
$ Email = 'langwan @ thizlinux.com.cn ';
$ Str = ____ ($ email ,'@');
$ Info = ____ ('.', $ str );
____ ($ Info );
?>
Output result:
Array ([0] => @ thizlinux [1] => com [2] => cn)
A: strchr, split, var_dump
B: strstr, explode, print_r
C: strstr, explode, echo
D: strchr, split, var, _ dump
11. Which of the following statements are true? (B)
A. the subscript of the array must be A number and start with "0 ".
B. The subscript of the array can be a weak string language.
C. The element types in the array must be consistent.
D. The subscript of the array must be continuous.
12. Which of the following statements is false? (C)
A. Common members belong to objects.
B. The member variables must be modified using public protected private. The var keyword is no longer required when defining the variables.
C. Static members belong to objects.
D. The class containing the abstract method must be an abstract class. The abstract class cannot be instantiated.
13. Which of the following statements about exit () and die () are true? (C)
A. When the exit () function is executed, it stops executing the following script, and die () cannot.
B. When the die () function is executed, it stops executing the following script, while exit () cannot.
C. Replace the exit () function with the die () function.
D. There is no difference between the die () function and the exit () function.
When you exit the program, the following script is stopped.
14. program running result (B) below)
<? Php
$ NextWeek = time () + (7*24*60*60 );
Echo 'now: '. date ('Y-m-d'). "\ n"; line feed
Echo 'Next Week: '. date ('Y-m-d', $ nextWeek). "\ n ";
?>
A. Get the date of today (month-day)
B. Obtain the date of today (year-month-day) and the date of next week (year-month-day)
C. Obtain the current time (hour-minute-second)
D. Obtain the interval from now till next week.
15. The following code execution result is: (D)
<? Php
Function print_A (){
$ A = "phpchina ";
Echo "A value:". $ A. "<p> ";
// Return ($ );
}
$ B = print_A ();
Echo "B value:". $ B. "<P> ";
?>
A value:
The value B is:
B A value:
B: phpchina
C a: phpchina
B: phpchina
D a value: phpchina
The value B is:
16. The following code execution result is: (c)
<? Php
$ A = "Hello ";
Function print_A ()
{
$ A = "php mysql !! ";
Global $;
Echo $;
}
Echo $;
Print_A ();
?>
A Hello
B php mysql !!
C Hello
D Hello php mysql !!
17. The output result of the following code is (B)
$ A = "aa ";
$ Aa = "bb ";
Echo $;
A aa
B bb
C $ aa
D $
18. The output result of the following code is ()
<? Php
$ A = 10;
$ B = & $ a; & get address
Echo $ B;
$ B = 15;
Echo $;
?>
A 1015
B 1010
C 1515
D 1510
19. Which of the following is true for php output concatenation strings? (C)
A echo $ a + "hello"
B echo $ a + $ B
C echo $ a. "hello"
D echo '{$ a} hello'
20. The possible cause of the 404 error when viewing a webpage in a browser is (B)
Page A source code error 500
File B does not exist
C. Database Connection Error
D. Insufficient Permissions
21. The output result of the following code is (D)
<? Php
$ Attr = array ("0" => "aa", "1" => "bb", "2" => "cc ");
Echo $ attr [1];
?>
A will report an error!
B aa
C output is empty
D bb
22. Which of the three object-oriented features is not encapsulation? (B)
A changes the Member to private
B. Change the Member to public
C encapsulation method to operate on Members
D. Use the _ get () and _ set () Methods to operate members.
23. The source code of php is ()
A. Open B. Closed C. Purchase D. Completely invisible
24. php output backslash (D)
A. (\ n B. \ r) line feed
C. \ t Tab
D. \ output a backslash
25. Which of the following does not belong to the three major features of OOP? (B)
A: encapsulate B: overload C: Inherit D: Polymorphism
26. Which of the following statements about strings is true? (c)
A: echo "hello \ nworld"; line feed source code can be implemented on the page
B: echo 'helloworld {$ a} '; the value of variable a can be parsed.
C: $ str = <AA
Hello world
AA;
This method can define strings
$ Str = <B
Agagafa
B; there cannot be anything in front of this line.
D: print $ a, "hello"; no error is reported for output data.
27. Which of the following statements is false? (D)
A: The list () function can be written in the equal sign. The only one on the left can be written in the left.
B: The each () function returns the next element in the array.
C: When foreach () traverses an array, it can traverse both the key and value.
D: The for loop can traverse associated arrays and only index arrays.
28. Which of the following statements about object-oriented is false? (C)
A: OOP is short for Object-Oriented
B: static members belong to the class.
C: normal members belong to the class.
D: The $ this keyword in the class indicates the object itself.
29. The following method for defining a function is correct (B)
A: public void Show () {} strong language
B: function Show ($ a = 5, $ B ){}
C: function Show (a, B ){}
D: function Show (int $ ){}
30. Which of the following options does not add john to the users array? (B)
A. $ users [] = "john ";
B. array_add ($ users, "john ");
C. array_push ($ users, "john ");
D. $ users ["aa"] = "john ";
31. Which of the following random numbers in php can output between 1 and 10 is (C)
A: echo rand ();
B: echo rand () * 10;
C: echo rand (1, 10 );
D: echo rand (10 );
32. The current time format can be output as follows in php: 13:10:56 is ()
A: echo date ("Y-m-d H: I: s ");
B: echo time ();
C: echo date ();
D: echo time ("Y-m-d H: I: s ");
33. Which of the following does not belong to the four elements of the function? (D)
A: return type
B: function name
C: parameter list
D: access modifier function body
34. Which of the following statements is true? (c)
A: @ can block all errors.
B: exit; subsequent statements can be executed.
C: 10/4 is 2.5.
D: $ a; this method is incorrect.
35. Which of the following statements about constructors is false? (B)
A: To study A class, the first function we want to study is the constructor.
B: There is no difference between the construct writing method and the normal function. The construct execution time is special when the new function is executed.
C: Special execution of Constructors
D: If a constructor exists in the parent class and a parameter is required, the Child class should also input the corresponding parameter when creating the object.
36. Which of the following statements about polymorphism is true? (D)
A: Polymorphism occurs when each object calls A method.
B: polymorphism is produced by defining different functions in the subclass.
C: The production of polymorphism requires no conditions
D: when the parent class references a subclass instance, because the subclass overwrites the method of the parent class, the differences between the parent class references and calls the corresponding function are called polymorphism.
37. How many lines of data will the following code output on the page ()
$ Attr = array (1, 2, 3, 4 );
While (list ($ key, $ value) = each ($ attr ))
{
Echo $ key. "=>". $ value. "<br> ";
}
While (list ($ key, $ value) = each ($ attr ))
{
Echo $ key. "=>". $ value. "<br> ";
}
A: 4 B: 6C: 8D: 12
38. Which of the following statements is true? (C)
A: $ attr indicates an array, so the array length can be obtained through $ attr. length in the js method.
Php count method
B: The unset () method cannot delete an element in the array.
C: php Arrays can store any type of data.
D: only the index array is in php.
39. Which of the following statements is false? (B)
A: The keyword used for fuzzy search is like.
B: The sorting query asc is in descending order, and the desc is in ascending order.
C: The keyword used for paging query is limit.
D: mysql can be used normally if only the installation service is installed without the installation interface.
40. The output result of the following code is (D)
$ A = "cc ";
$ Cc = "dd ";
Echo $ a = "cc "? "{$ A}": $;
A? B: C
Determine the value of A. true: Execute B. false: Execute C.
A: cc
B: $
C: $
D: dd
II, Question(10 questions in total, 2 points per question)
1. in php, boolean data has only two values: true and false. (√)
2. The character connecting two strings in php is "+ ". (×)
3. php can use "scanf" to print output results. (×)
4. ";" must be added at the end of each statement to indicate that the statement has ended. (√)
5. Before using php variables, you must define the variable type. (×)
6. in php, "=" means "equal ". (√) = Value assignment
7. Both the while and do-while statements determine the conditions before executing the loop body. (×)
8. "break" indicates a jump out of the loop. (√)
9. If the keyword key is omitted when the array is defined, the keyword of the third array element is 3. (×)
10. select statements are used to query data in the mysql database. (√)