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.
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.
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.
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
c) Win Object
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.
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)*
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?
c) (x* + y)
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.
- Buy Computer Science Books
- Practice MCA MCQs
- Buy Compiler Design Books
- Apply for Compiler Design Internship
- Practice Computer Science MCQs