Analysis of Php,mysql Quiz exercises

Source: Internet
Author: User
Tags echo date explode php language php definition php mysql scalar

Judgment question

Judgment question (total Questions , 2 per question points)

1. There are only two values for Boolean type data in PHP: True and False. () ture and flase Chinese translation logic type

2. The symbol for connecting two strings in PHP is "+". (wrong) PHP is used for '. ' No '. '

3. PHP can use "scanf" to print out the results. (wrong) scanf is not a keyword for printing results

4. At the end of each statement, ";" is added to indicate the end of the statement. (pair) fixed format

5. You need to define the variable type before using PHP variables. (wrong) because PHP is a weakly typed language, the system customizes the data type

6. in php, "= =" means "equals". To

7. Both the while and the Do-while statements evaluate the condition before executing the loop body. (wrong) while is the first to perform the re-judgment; Do-while is the first to judge the execution

8. "Break" means to jump out of a loop. To

Remember the difference between break and return

Break is jumping out of the loop
Return is jumping to the beginning of the loop to continue execution

9. If you omit the keyword key when defining an array, the third element of the array has a keyword of 3. Wrong

It's starting from 0, so the third is the element's key word is 2.

10. Query data in MySQL database with SELECT statement. To

Query Statement Slect

Select title:

1. Lamp specific structure does not contain any of the following (A)

A:windows system

B:apache Server

C:mysql Database

d:php language

Parse Apache server; MySQL database; php language;

2. Which of the following SQL statements is correct (D)

A:insert into users (' p001 ', ' Zhang San ', ' Male '); There should be values behind--users.

B:create table (Code int primary key); --Incorrect format

C:update users code= ' p002 ' where code= ' p001 ';--Ibid.

D:select code as ' code ' from Users;--as displays the contents of the single quotation mark

3. Which of the following types is the correct description of the B/S Architecture (C)

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 (C)

A:echo

B:print

C:var_dump ()

D:print_r ()

Php Basic Knowledge Test questions

Name: Liu Kangkang class: z1p10410 results:

This test is a total of 40 choice questions, 10 judgment questions, examination time 1.5 hours

One: Choice question (single choice, 2 per question points):

1. Lamp specific structure does not contain any of the following (A)

A:windows system

B:apache Server

C:mysql Database

d:php language

2. Which of the following SQL statements is correct (A)

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 (C)

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 (C)

A:echo Universal Output Statement

B:print

C:var_dump () Test output results

D:print_r ()

5. The PHP definition variable is correct (B)

A:var a = 5;

B: $a = 10;$ symbol

C:int B = 6;

D:var $a = 12;

6. The difference between single and double quotation marks in PHP that contains a string is correct (D)

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 (B)

$x = 1;

+ + $x; Highest priority level

$y = $x + +; Lowest priority level

A:1 b:2 C:3 d:0

8. The following statement about string handling functions in PHP is correct (C)

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: (A) ¥¥¥¥¥

<?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: (B) ¥¥¥¥¥¥

<?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: (B)

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? (AC)

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, cannot be called directly in the subclass.

D. Classes containing abstract methods must be abstract classes, abstract classes cannot be instantiated

13. The statement about exit () and Die () is correct (B) c

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 (B) Memory $$$$$$$$$$$$$$$

<?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 executes the result: (D)

<?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: (C) Memory $$$$$$$$$$$$$$$$$$$$$

<?php

$A = "Hello";

Functionprint_a ()

{

$A = "php mysql!!";

Global $A;

Echo $A;

}

echo$a;

Print_a ();

?>

Ahello

bphp MySQL!!

Chello Hello

Dhello php mysql!!

17, the result of the following code output is (B)

$a = "AA";

$AA = "BB";

echo $ $a;

Aaa

Bbb

C$aa

d$ $a

18, the result of the following code output is (B)

<?php

$a = 10;

$b =& $a;

Echo $b;

$b = 15;

echo $a;

?>

A1015

B1010

C1515

D1510

19, the PHP output stitching string is correct (C)

Aecho $a + "Hello"

Becho $a + $b

Cecho $a. " Hello

Decho ' {$a}hello '

20.404 error when viewing Web pages in a browser the probable cause is (b)

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 (D)

<?php

$attr =array ("0" = "AA", "1" = "BB", "2" and "CC");

ECHO$ATTR[1];

?>

A will error!

Baa

C Output is empty

Dbb

22. Which of the three main object-oriented features is not a encapsulation approach (B)

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)????????

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

24, PHP How to output backslash (D)

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

25. Which of the following does not belong to the three major features of OOP (B)

A: Package B: Overload C: Inherit D: polymorphic

26. The following statement about the string is correct (C) $$$$$$$$$$$$$$$$

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

Helloworld

AA;

This way you can define a string

D:print $a, "hello"; can output data without error

27. The following statements are incorrect (d) d

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 can traverse associative arrays,---can only traverse arrays

Parsing: Associative arrays are similar to regular arrays, which contain scalar data, which can be selected individually by index values, and unlike regular arrays, the index value of an associative array is not a nonnegative integer but an arbitrary scalar. These scalars are called Keys and can be used later to retrieve the values in the array.

The elements of an associative array are not in a particular order, and you can think of them as a set of cards. The upper part of each card is indexed and the lower half is the value.

Associative arrays are unique in the Perl language, and associative arrays are a powerful array. To use an associative array, precede with the% number, and the format of the associative array is as follows:

%array= (KEY1,VALUE1,KEY2,VALUE2,KEY3,VALUE3);

Each key has a value that corresponds to it.

28, about the object-oriented statement is not correct (C)

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 (B)

a:public void Show () {}

B:function Show ($a =5, $b) {} Define a $ A value in advance

C:function Show (A, b) {}

D:function Show (int $a) {}

30. Which of the following options does not add John to the users array? (b)

A. $users [] = "John";

B.array_add ($users, "John"); no such statement

C.array_push ($users, "John");

D. $users ["AA"]= "John"; replace John with AA

31, the following in PHP can output 1 to 10 of the random number is (C)

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-613:10:56 is (a)

A:echo date ("y-m-d h:i:s"); time stamp not required

B:echo time ();

C:echo date ();

D:echo time ("y-m-d h:i:s"); timestamp required

33. Which of the following is not a function of four elements: return type; function name; parameter list; functions body

A: return type

B: Name of function

C: Parameter list

D: Access modifier correct: function body

34. The following statement is correct (C)

a:@ symbol can block all errors
B:exit; The following statement can continue execution

C:10/4 The result is that the 2.5 PHP language is a weakly typed language

d:$ $a; this is wrong.

35. The following remarks about the constructor are incorrect (B)

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 statements about polymorphism are correct (D)

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 outputs how many rows of data will be printed on the page (A) The second loop cannot enter after each traversal

$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:6 C:8 D:12

38, the following statement is correct is (c) c

A: $attr represents an array, then the length of the array can be obtained by $attr.length with Count
The B:unset () method cannot delete an element inside an array

The c:php array can store the characteristics of any type of data weakly typed language.

d:php only indexed arrays

39. The following statement is incorrect (B)

A: The keyword used by fuzzy queries is like
B: Sort query asc is descending, desc is ascending ase is ascending; DESC is descending

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 (D)

$a = "CC";

$CC = "DD";

echo $a = = "CC"? "{$ $a}": $a;

A:cc
B: $a

c:$ $a

D:dd

Analysis of Php,mysql Quiz exercises

Related Article

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.