Explore topic-wise MCQs in Php.

This section includes 10 Mcqs, each offering curated multiple-choice questions to sharpen your Php knowledge and support exam preparation. Choose a topic below to get started.

1.

Parameter flags was added in which version of PHP?

A. PHP 4.0
B. PHP 4.1
C. PHP 4.2
D. PHP 4.3
Answer» E.
2.

Which one of the following is not a preg PHP function?

A. preg_match
B. preg_match_all
C. preg_matchall
D. preg_split
Answer» D. preg_split
3.

Which one of the following preg PHP functions is used to take a string, and put it in an array?

A. preg_destroy()
B. preg_split()
C. preg_unchain()
D. preg_divide()
Answer» C. preg_unchain()
4.

Which one of the following preg PHP function is used to do a find and replace on a string or an array?

A. preg_replace()
B. preg_find()
C. preg_find_replace()
D. preg_findre()
Answer» B. preg_find()
5.

Which one of the following functions are used to search a string?

A. preg_match
B. preg_search
C. preg_find
D. preg_found
Answer» B. preg_search
6.

What will be the output if we replace the line $num = preg_grep(“/[0-5]/”, $number); with $num = preg_grep(“/[0-5]/”, $number, PREG_GREP_INVERT);?

A. Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5)
B. Array([2]=>two [3]=>three [4]=>four)
C. Array([1]=> 1)
D. Array([0]=>0 [5]=>5)
Answer» C. Array([1]=> 1)
7.

WHICH_ONE_OF_THE_FOLLOWING_PREG_PHP_FUNCTIONS_IS_USED_TO_TAKE_A_STRING,_AND_PUT_IT_IN_AN_ARRAY??$

A. preg_destroy()
B. preg_split()
C. preg_unchain()
D. preg_divide()
Answer» E.
8.

tea?

A. Hello! My name is Cameron Fox. tea?
B. Hello! My name is Cameron Fox. Coffee?
C. Hello! My name was Cameron Fox. Coffee?
Answer» D.
9.

What will be the output if we replace the line $num = preg_grep(“/[0-5]/”, $number); with $num = preg_grep(“/[0-5]/”, $number, PREG_GREP_INVERT);?$

A. Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5)
B. Array([2]=>two [3]=>three [4]=>four)
C. Array([1]=> 1)
D. Array([0]=>0 [5]=>5)
Answer» B. Array([2]=>two [3]=>three [4]=>four)
10.

Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5)

A. Array([2]=>two [3]=>three [4]=>four)
B. Array([1]=> 1)
C. Array([0]=>0 [1]=>1 [5]=>5)
Answer» C. Array([0]=>0 [1]=>1 [5]=>5)