P HP basic Knowledge test questions
Name: Class: Results:
This question is a total of nine choice questions,ten - way judgement, test time 1 half an hour
One: Choice of title (single choice, 2 points per question):
1. Lamp specific structure does not contain any of the following ()
A:windows system
B:apache Server
C:mysql Database
d:php language
2. Which of the following SQL statements is correct ()
A:insert into users (' p001 ', ' Zhang San ', ' Male ');
B:create table (Code int primary key);
C:update users code= ' p002 ' where code= ' p001 ';
D:select code as ' code ' from users;
3. Which of the following types is the correct description of the B/S architecture ()
A: Customers are required to install the client
B: You can use it without the need for installation
C: Web system based on browser
D: Systems that do not require a server
4. Which statement in PHP can output a variable type ()
A:echo
B:print
C:var_dump ()
D:print_r ()
5. PHP defines the variable correctly ()
A:var a = 5;
B: $a = 10;
C:int B = 6;
D:var $a = 12;
6. The difference between single and double quotation marks in PHP that contain strings is correct ()
A: Single quote speed is fast, double quotation mark speed is slow
B: Double quotes fast, single quote slow
C: An escape character can be parsed inside a single quotation mark
D: double quotes inside can parse variables
7. If x, y is an integer data, the following statement performs a $y result of ()
$x = 1;
+ + $x;
$y = $x + +;
A:1 b:2 C:3 d:0
8. The following statement about string handling functions in PHP is correct ()
The A:implode () method can split a string into arrays
B:str_replace () can replace a string at the specified position
C:SUBSTR () can intercept strings
D:strlen () cannot take the length of a string
9. The following code runs the result: ()
<?php
$first = "This course are very easy!";
$second = Explode ("", $first);
$first = Implode (",", $second);
Echo $first;
?>
A this,course,is,very,easy,!
B This course are very easy!
C This course are very easy!,
D hint Error
10. The functions that should be used at the following horizontal lines are: ()
<?php
$email = ' [email protected] ';
$str = ____ ($email, ' @ ');
$info = ____ ('. ', $str);
____ ($info);
?>
The output is:
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. The following statements are correct: ()
A. The subscript of an array must be a number and start with "0"
B. The subscript of an array can be a string
C. The elements in the array must be of the same type
D. The subscript of an array must be contiguous
12. Which of the following descriptions is wrong? ( )
A. The constructor and destructor of the parent class are not automatically called
B. Member variables need to be decorated with public protected private, var keyword is no longer required when defining variables
C. Static members defined in the parent class, and cannot be called directly in a subclass
D. Classes containing abstract methods must be abstract classes, abstract classes cannot be instantiated
13. The statement about exit () and Die () is correct ()
A, when exit () function execution will stop executing the following script, and die () cannot do
B, when the Die () function execution will stop executing the following script, and exit () cannot do
The C, Die () function is equivalent to the exit () function
D, die () function is not directly related to the exit () function
14, the following program operation results ()
<?php
$nextWeek = time () + (7 * 24 * 60 * 60);
Echo ' Now: '. Date (' y-m-d '). " \ n ";
Echo ' Next Week: '. Date (' y-m-d ', $nextWeek). " \ n ";
?>
A, get today's date (month-day)
B, get today's date (year-month-day) with next week's date (year-month-day)
C, get the current time (hours-minutes-seconds)
D, get the time between now and next week
15, the following code execution results are: ()
<?php
function Print_a () {
$A = "Phpchina";
echo "A value is:" $A. " <p> ";
return ($A);
}
$B = Print_a ();
echo "B value is:" $B. " <P> ";
?>
A A value is:
The B value is:
B a value is:
The B value is: Phpchina
C A value is: Phpchina
The B value is: Phpchina
D A value is: Phpchina
The B value is:
16, the following code execution results are: ()
<?php
$A = "Hello";
function Print_a ()
{
$A = "php mysql!!";
Global $A;
Echo $A;
}
Echo $A;
Print_a ();
?>
A Hello
B php mysql!!
C Hello Hello
D Hello php mysql!!
17, the result of the following code output is ()
$a = "AA";
$AA = "BB";
echo $ $a;
A AA
B BB
C $AA
D $ $a
18, the result of the following code output is ()
<?php
$a = 10;
$b = & $a;
Echo $b;
$b = 15;
echo $a;
?>
A 1015
B 1010
C 1515
D 1510
19, the PHP output stitching string is correct ()
A echo $a + "Hello"
B Echo $a + $b
C echo $a. " Hello
D Echo ' {$a}hello '
20.404 error when viewing Web pages in a browser the possible cause is ()
A Page Source code error
B file does not exist
C connection Error with database
D Insufficient Permissions
21. The result of the following code output is ()
<?php
$attr = Array ("0" = "AA", "1" = "BB", "2" and "CC");
echo $attr [1];
?>
A will error!
B AA
C output is empty
D BB
22. Which of the three main object-oriented features is not a encapsulation approach ()
A to turn a member into private
B turn members into public
C encapsulation method to manipulate members
D Use the __get () and __set () methods to manipulate members
23, the source Code of PHP is ()
A Open B. Closed C. Need to purchase D. Completely invisible.
24, PHP How to output backslash ()
A \ n B. \ r C. \ t D. \\
25. Which of the following does not belong to the three major features of OOP ()
A: Package B: Overload C: Inherit D: polymorphic
26. The following statement about the string is correct ()
A:echo "Hello\nworld"; line wrapping can be implemented on the page
B:echo ' helloworld{$a} '; You can parse the value of variable a
C: $str =<<<aa
Hello World
AA;
This way you can define a string
D:print $a, "hello"; can output data without error
27. The following statement is incorrect ()
The A:list () function can be written to the left of the equals sign
The B:each () function can return the next element inside the array
C:foreach () can traverse the array while traversing the key and value
D:for loops to traverse associative arrays
28, about the object-oriented argument is not correct is ()
A:oop is an object-oriented abbreviation
B: Static members are class-owned
C: Ordinary members belong to the class
D: The $this keyword inside the class represents the object itself
29. The following defines the function in the correct way ()
a:public void Show () {}
B:function Show ($a =5, $b) {}
C:function Show (A, b) {}
D:function Show (int $a) {}
30. Which of the following options does not add John to the users array? ( )
A. $users [] = "John";
B. Array_add ($users, "John");
C. Array_push ($users, "John");
D. $users ["AA"]= "John";
31, the following in PHP can output 1 to 10 of the random number is ()
A:echo rand ();
B:echo rand () *10;
C:echo rand (1,10);
D:echo rand (10);
32, the following in PHP can output the current time format like: 2016-5-6 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 ()
A: return type
B: Name of function
C: Parameter list
D: Access modifier
34. The following statement is correct ()
a:@ symbol can block all errors
B:exit; The following statement can continue execution
C:10/4 the result is 2.5.
d:$ $a; this is wrong.
35. The following about the constructor is incorrect ()
A: To study a class, the first thing we want to look at is the constructor
B: There is no difference between a constructor and a normal function
C: Constructors perform relatively special
D: If a constructor is present in the parent class and a parameter is required, the subclass should also pass in the corresponding parameter when making the object.
36. The following statement about polymorphism is correct ()
A: Polymorphic occurs when each object invokes a method
B: Polymorphism is caused by the definition of different functions within subclasses.
C: polymorphic generation does not require conditions
D: When the parent class refers to a subclass instance, because the child class overrides the method of the parent class, the differences that appear when the parent class refers to the corresponding function are called polymorphic.
37, the following code on the page will output how many rows of data ()
$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. The following statement is correct ()
A: $attr represents an array, then the length of the array can be obtained by $attr.length
The B:unset () method cannot delete an element inside an array
An array of c:php can store any type of data
d:php only indexed arrays
39, the following statement is not correct is ()
A: The keyword used by fuzzy queries is like
B: Sort query asc is descending, desc is ascending
C: The keyword used for paging queries is limit
D:mysql If the install only service does not install the interface can also be used normally
40. The result of the following code output is ()
$a = "CC";
$CC = "DD";
echo $a = = "CC"? "{$ $a}": $a;
A:cc
B: $a
c:$ $a
D:dd
two , Judgment questions (Total , 2 points per question)
1. There are only two values for Boolean type data in PHP: True and False. ( )
2. The symbol for connecting two strings in PHP is "+". ( )
3. PHP can use "scanf" to print out the results. ( )
4. At the end of each statement, ";" is added to indicate the end of the statement. ( )
5. You need to define the variable type before using PHP variables. ( )
6. in php, "= =" means "equals". ( )
7. Both the while and the Do-while statements evaluate the condition before executing the loop body. ( )
8. "Break" means to jump out of a loop. ( )
9. If you omit the keyword key when defining an array, the third element of the array has a keyword of 3. ( )
10. Query data in MySQL database with SELECT statement. ( )
ADCCB dbcab bacbd cbacb dbadb cdcbb cadcb dacbd right wrong right wrong right wrong right
PHP Basic Knowledge test questions