This set of Compilers Multiple Choice Questions & Answers (MCQs) focuses on “Regular Expression – 1”.
1. A regular expression enables a quick test to determine objects and text strings with undependable values.
a) True
b) False
View Answer
Explanation: Because it checks for all the values and determines whether the output string matches with the given string.
2. RE can be used only for values of type string and number.
a) True
b) False
View Answer
Explanation: No not for all values the string and numbers can we use the RE.
3. You can use RE, if you expect the value of a property to change in an unpredictable way each time its run.
a) True
b) False
View Answer
Explanation: For every cycle the values does not change unpredictably because the type of grammar that it accepts is defined.
4. All ___________ are automatically treated as regular expressions.
a) Programmatic description
b) Window
c) Win Object
d) Collection
View Answer
Explanation: The programmatic description is genuinely treated as regular expression.
5. If a ‘/’ is used before a character that has no special meaning, ‘/’ is ignored.
a) True
b) False
View Answer
Explanation: The backslash carries no significance and it is ignored.
6. The regular expression denotes a language comprising all possible strings of even length over the alphabet (0, 1).
a) 1 + 0(1+0)*
b) (0+1) (1+0)*
c) (1+0)
d) (00+0111+10)*
View Answer
Explanation: Option 1 + 0(1+0)* → It does not consider even length criteria for the question.
Option (0+1) (1+0)* → It can so happen here that from the former bracket it takes 0 or 1 and takes null from the latter then it forms a string of odd length
Option (1+0) → It gives either 1 or 0.
Hence Option (00+0111+10)* is the answer.
7. The RE gives none or many instances of an x or y is?
a) (x+y)
b) (x+y)*
c) (x* + y)
d) (xy)*
View Answer
Explanation: Whether x or y is denoted by x+y and for zero or more instances it is denoted but (x+y)*.
Sanfoundry Global Education & Learning Series – Compilers.
To practice all areas of Compilers, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Apply for Computer Science Internship
- Check Computer Science Books
- Practice Computer Science MCQs
- Practice MCA MCQs
- Check Compiler Design Books