Question 16320 – UGC NET Dec-2020 and June-2021 Paper-2
December 2, 2023Question 3578 – Theory-of-Computation
December 2, 2023Question 2774 – Theory-of-Computation
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
Correct Answer: D
Question 413 Explanation:
This problem looks very difficult but solving procedure is very easy.
Given regular expression is p+[3-5]*[xyz]
It means we have to start with p.
[3-5]* means (3+4+5)* It can generate these numbers many number of times.
[xyz] → ends with either x or y or z or any combination but not violate order of occurrences
I. p443y → matched because it satisfied above regular expression.
Il. p6y → not matched because 6 not present in regular expression.
III. 3xyz → not matched because it not starts with p.
IV. p35z → matched because it satisfied above regular expression.
V. p353535x → matched because it satisfied above regular expression.
Vl. ppp5 → not matched because it is not end with x or y or z or any combination.
Given regular expression is p+[3-5]*[xyz]
It means we have to start with p.
[3-5]* means (3+4+5)* It can generate these numbers many number of times.
[xyz] → ends with either x or y or z or any combination but not violate order of occurrences
I. p443y → matched because it satisfied above regular expression.
Il. p6y → not matched because 6 not present in regular expression.
III. 3xyz → not matched because it not starts with p.
IV. p35z → matched because it satisfied above regular expression.
V. p353535x → matched because it satisfied above regular expression.
Vl. ppp5 → not matched because it is not end with x or y or z or any combination.
I, III and VI only
IV, V and VI only
II, IV and V only
I, IV and V only