Java Programming Lab
1) What is the significance of Matcher class for regular expression in java?
interpretest both pattern and performs match operations in the string interpretes pattern in the string Performs match in the string None of the mentioned
2) Which capturing group can represent the entire expression?
group * group 0 group * or group 0 None of the mentioned
3) What does public int end(int group) return?
offset from last character of the subsequent group offset from first character of the subsequent group offset from last character matched offset from first character matched
4) Which of the following identity is wrong?
R + R = R (R*)* = R* Both A and B (phi)R = R(phi) = RR*
5) Which of the following is not a class of java.util.regex?
Pattern class matcher class PatternSyntaxException Regex class
6) Regular expressions are used to represent which language
Recursive language Context free language Regular language All of these
7) The set of all strings over Sigma = {a,b} in which all strings having bbbb as substring is:
(a+b)* bbbb (a+b)* (a+b)* bb (a+b)*bb bbbb (a+b)* bb (a+b)*
8) What does public int start() return?
returns start index of the input string returns start index of the current match returns start index of the previous match none of the mentioned
9) Which of the following statements about the regex API are true?
Instances of the Pattern class are used to match character sequences against a given pattern The package java.util.regex includes an exception called PatternSyntaxException Instances of Matcher class are used to represent regular expressions in the form of String type None of the above
10) What are the main methods of Java Regex?
matches lookingAt find All of the above
Number of score out of 10 = Score in percentage =