Web Designing MCQs

Top 20 MCQ Questions on POSIX Regular Expressions in PHP

Google+ Pinterest LinkedIn Tumblr
Here are the collections of top 20 MCQ questions on POSIX regular expressions in PHP includes multiple-choice questions on fundamentals of regular expressions syntax in POSIX format. It includes MCQ questions on POSIX implementation of the regular expression such as brackets, quantifiers, and predefined character classes used on PHP.

It also includes objective type questions on different PHP’s regular expression functions for performing case-sensitive and case-insensitive search along with splitting the string into various elements based on case sensitive and case-insensitive patterns.

Read Also: Top 20 MCQ Questions on Exception Handling in PHP

1) The POSIX implementation of regular expression was deprecated in the PHP version…
A. 5.2
B. 5.3
C. 5.4
D. 6

2) State whether the following statements about regular expression are TRUE or FALSE.
i. A regular expression is nothing more than a pattern of characters itself that was matched against a certain parcel of text.
ii. It may be a pattern with which you are already familiar or it may be a pattern with specific meaning in the context of the word of pattern matching.
A. i-True, ii-False
B. i-False, ii-True
C. i-False, ii-False
D. i-True, ii-True

3) … are used to represent a list or range of characters to be matched.
A. []
B. {}
C. ()
D. /*

4) In PHP’s regular expression, … matches any string containing at least one a.
A. a*
B. a
C. a+
D. a{1}

5) The regular expression, … matches any string containing zero or more a’s.
A. a*
B. a
C. a+
D. a{1}

6) The regular expression, … matches any string containing zero or one a.
A. a*
B. a
C. a+
D. a?

7) The … matches any string not containing any of the characters ranging from a through z and A through Z.
A. [a-zA-Z]
B. {^a-zA-Z}
C. [^a-zA-Z]
D. [^a-z-A-Z]

8) … matches any string containing a ‘b’ followed by zero or more instances of the sequence of ‘ag’.
A. b[ag]
B. b(ag)+
C. b(ag)
D. b(ag)*

9) … matches any string inclosed within <i> and </i>.
A. <i>(.*)</i>
B. <i>[.*]</i>
C. <i>(.?)</i>
D. <i>[*]</i>

10) The predefined character class … specifies the lowercase and uppercase alphabetical characters and numeric digits.
A. [:alpha:]
B. [:graph:]
C. [:alnum:]
D. [:num:]

11) The predefined default character class … can also be specified as [A-Za-z].
A. [:alpha:]
B. [:graph:]
C. [:alnum:]
D. [:num:]

12) The predefined default character class … specifies printable characters found in the range of ASCII 33 to 126.
A. [:alpha:]
B. [:graph:]
C. [:alnum:]
D. [:char:]

13) PHP offers …. functions for searching strings using POSIX style regular expressions.
A. five
B. six
C. seven
D. eight

14) The PHP’s regular expression function, … executes a case-sensitive search of string for a defined pattern.
A. eregi()
B. ereg()
C. regi()
D. regse()

15) You can perform case insensitive search with the function … in PHP’s regular expression.
A. eregi()
B. ereg()
C. regi()
D. regse()

16) The … function will be useful when checking the validity of strings, such as passwords.
A. eregi()
B. ereg()
C. regi()
D. regse()

17) The … function will split a string into various elements based on case insensitive pattern.
A. eregi()
B. ereg()
C. split()
D. spliti()

18) The … function converts each character in a string into a bracketed expression containing two characters.
A. eregi()
B. eregcase()
C. sql_regcase()
D. regcase()

19) The predefined character class … will specify whitespace characters, including space, horizontal tab, vertical tab, newline, form feed, or carriage return.
A. [:tab:]
B. [:space:]
C. [:whitespace:]
D. [:char:]

20) The regular expression … will match any string containing exactly three characters.
A. ^.{3}$
B. ^.{3}
C. {3}$
D. *{3}$

Answers

  1. B. 5.3
  2. D. i-True, ii-True
  3. A. []
  4. C. a+
  5. A. a*
  6. D. a?
  7. C. [^a-zA-Z]
  8. D. b(ag)*
  9. A. <i>(.*)</i>
  10. C. [:alnum:]
  11. A. [:alpha:]
  12. B. [:graph:]
  13. C. seven
  14. B. ereg()
  15. A. eregi()
  16. A. eregi()
  17. D. spliti()
  18. C. sql_regcase()
  19. B. [:space:]
  20. A. ^.{3}$

Read Next: Top 20 MCQ Questions on Perl Regular Expressions in PHP

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Write A Comment