0% found this document useful (0 votes)
75 views5 pages

Quiz 1 - PHP

The document contains 25 multiple choice questions about PHP concepts such as variables, arrays, functions, classes, and more. Key points covered include: - Variables in PHP start with $, are assigned with =, and hold the value of the most recent assignment. - NULL is a special variable type that can only have one value. - Associative arrays use strings as indexes. - rsort() sorts an array in reverse order. - mysqli_close() closes a MySQLi database connection. - PHP is a server-side scripting language embedded in HTML used for dynamic web content and databases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views5 pages

Quiz 1 - PHP

The document contains 25 multiple choice questions about PHP concepts such as variables, arrays, functions, classes, and more. Key points covered include: - Variables in PHP start with $, are assigned with =, and hold the value of the most recent assignment. - NULL is a special variable type that can only have one value. - Associative arrays use strings as indexes. - rsort() sorts an array in reverse order. - mysqli_close() closes a MySQLi database connection. - PHP is a server-side scripting language embedded in HTML used for dynamic web content and databases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Q 1 - Which of the following is true about php variables?

A - All variables in PHP are denoted with a leading dollar sign ($).

B - The value of a variable is the value of its most recent assignment.

C - Variables are assigned with the = operator, with the variable on the left-hand side and the
expression to be evaluated on the right.

D - All of the above.

Q 2 - Which of the following type of variables are special type that only has one value: NULL?

A - Strings

B - Doubles

C - Booleans

D - NULL

Q 3 - Which of the following array represents an array with strings as index?

A - Numeric Array

B - Associative Array

C - Multidimentional Array

D - None of the above.

Q 4 - Which of the following function sorts an array in reverse order?

A - rsort()

B - sort()

C - shuffle()

D - reset()

Q 5 - Which of the following method can be used to close a MySqli database using PHP?

A - mysqli_connect()

B - mysqli_query()
C - mysql_close()

D - None of the above

Q 6 - Which of the following is correct about PHP?

A - PHP is a recursive acronym for "PHP: Hypertext Preprocessor".

B - PHP is a server side scripting language that is embedded in HTML.

C - It is used to manage dynamic content, databases, session tracking, even build entire e-commerce
sites.

D - All of the above.

Q 7 - Using which of the following way can you embed PHP code in an HTML page?

A - <?php PHP code goes here ?>

B - <? PHP code goes here ?>

C - <script language="php"> PHP code goes here </script>

D - All of the above.

Q 8 - Is PHP case sensitive?

A - false

B - true

Q 9 - Which of the following is true about php variables?

A - All variables in PHP are denoted with a leading dollar sign ($).

B - The value of a variable is the value of its most recent assignment.

C - Variables are assigned with the = operator, with the variable on the left-hand side and the
expression to be evaluated on the right.

D - All of the above.

Q 10 - Which of the following type of variables are instances of programmer-defined classes?

A - Strings

B - Arrays
C - Objects

D - Resources

Q 11 - Which of the following type of variables are special variables that hold references to resources
external to PHP (such as database connections)?

A - Strings

B - Arrays

C - Objects

D - Resources

Q 12 - Which of the following array represents an array containing one or more arrays?

A - Numeric Array

B - Associative Array

C - Multidimentional Array

D - None of the above.

Q 13 - Which of the following operator is used to concatenate two strings?

A-.

B-+

C - append

D - None of the above.

Q 14 - Which of the following function is used to get length of a string?

A - size()

B - strlen()

C - length

D - None of the above.

Q 15 - Which of the following variable is used to generate random numbers using PHP?
A - srand()

B - rand()

C - random()

D - None of the above.

Q 16 - Which of the following function is used to redirect a page?

A - redirect()

B - header()

C - reflect()

D - None of the above.

Q 17 - Which of the following is used to get information sent via get method in PHP?

A - $_GET

B - $GET

C - $GETREQUEST

D - None of the above.

Q 18 - Which of the following function creates an array?

A - array()

B - array_change_key_case()

C - array_chunk()

D - array_count_values()

Q 19 - If there is any problem in loading a file then the require() function generates a warning but the
script will continue execution.

A - true

B - false

Q 20 - Which of the following function opens a file?

A - fopen()

B - fread()
C - filesize()

D - file_exist()

Q 21 - Can you assign the default values to a function parameters?

A - true

B - false

Q 22 - Which of the following method can be used to create a MySql database using PHP?

A - mysql_connect()

B - mysql_query()

C - mysql_close()

D - None of the above

Q 23 - Which of the following method acts as a constructor function in a PHP class?

A - class_name()

B - __construct

C - constructor

D - None of the above.

Q 24 - final keyword prevents child classes from overriding a method by prefixing the definition with
final?

A - true

B - false

Q 25 - Which of the following keyword causes the loop to skip the remainder of its body and
immediately retest its condition prior to reiterating?

A - break

B - continue

You might also like