UGC-NET | UGC NET CS 2017 Jan – II | Question 31

Which of the following strings would match the regular expression :
p+ [3 – 5]∗ [xyz]?
I. p443y
II. p6y
III. 3xyz
IV. p35z
V. p353535x
VI. ppp5
(A) I, III and VI only
(B) IV, V and VI only
(C) II, IV and V only
(D) I, IV and V only


Answer: (D)

Explanation:

I. p443y  valid    
II. p6y   invalid 
III. 3xyz  invalid  
IV. p35z     valid
V. p353535x  valid
VI. ppp5     invalid

So, option (D) is correct.


Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.