PHP Regular Expressions MCQs

PHP Regular Expressions MCQs : This section focuses on "Regular Expressions" in PHP. These Multiple Choice Questions (mcq) should be practiced to improve the PHP skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.

1. Regular expressions are nothing more than a sequence or pattern of characters itself.

A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

View Answer


2. PHP offers functions specific to ________ sets of regular expression functions

A. 1
B. 2
C. 3
D. 4

View Answer


3. ______________ have a special meaning when used in the context of regular expressions.

A. ()
B. {}
C. []
D. $

View Answer


4. Which of the following expression matches any character from uppercase A through uppercase Z?

A. [a-z]
B. [A-Z]
C. [a-Z]
D. None of the above

View Answer


5. Which of the following expression matches any string containing at least one p?

A. p*
B. p-
C. p^
D. p+

View Answer


6. What is use of expression p$?

A. It matches any string containing zero or more p's.
B. It matches any string containing zero or one p's.
C. It matches any string with p at the end of it.
D. It matches any string with p at the beginning of it.

View Answer


7. The __________ function searches a string specified by string for a string specified by pattern, returning true if the pattern is found, and false otherwise.

A. ereg_replace()
B. ereg()
C. eregi()
D. eregi_replace()

View Answer


8. [:alpha:] can also be specified as ________

A. [A-Za-z0-9]
B. [A-za-z]
C. [A-z]
D. [a-z]

View Answer


9. How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions.

A. 5
B. 6
C. 7
D. 8

View Answer


10. The spliti() function operates exactly in the same manner as its sibling split(), except that it is not case sensitive.

A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

View Answer




Discussion


* You must be logged in to add comment.