This set of Compilers Interview Questions and Answers focuses on “Finite Automata and Regular Expressions – 2”.
1. Which of the following strings is not generated by the following grammar?
S → SaSbS|ε
a) aabb
b) abab
c) aababb
d) aaabbb
View Answer
Explanation: Given S → SaSbS|ε
S->aSbS putting S-> € and then S->SaSbS
S->aSaSaSbSbSbS putting S->SaSbS
S->aaabbb putting S->€.
2. Regular expressions can be used only for values of type string and number.
a) True
b) False
View Answer
Explanation: RE is used for all types of string and numbers.
3. What is the Regular Expression Matching Zero or More Specific Characters?
a) x
b) #
c) *
d) &
View Answer
Explanation: Zero or Specific Expression matching can be done only by a single character that is*.
4. All __________ are automatically treated as regular expressions.
a) Programmatic description
b) Window
c) Win Object
d) Collection
View Answer
Explanation: It is seen that programmatic description are treated as regular expression.
5. Regular Expressions can be used with XML checkpoints.
a) True
b) False
View Answer
Explanation: XML checkpoints employ RE.
6. The production Grammar is {S->aSbb,S->abb} is __________ grammar.
a) Type-3
b) Type-2
c) Type-1
d) Type-0
View Answer
Explanation: As per the definition of type-2 grammar.
7. Regular expression (x/y)(x/y) denotes which of the following set?
a) {xy,xy}
b) {xx,xy,yx,yy}
c) {x,y}
d) {x,y,xy}
View Answer
Explanation: From first part if we take x then from the latter part x then it forms xx
From first part if we take x then from the latter part y then it forms xy
From first part if we take y then from the latter part x then it forms yx
From first part if we take y then from the latter part y then it forms yy.
8. Regular expression x/y denotes which of the following set?
a) {x,y}
b) {xy}
c) {x}
d) {y}
View Answer
Explanation: Because either x or y can be selected.
9. The regular expressions denote zero or more instances of an x or y is?
a) (x+y)
b) (x+y)*
c) (x* + y)
d) (xy)*
View Answer
Explanation: For instances of x or y the exp is x+y and both can zero or more times than (x+y)*.
Sanfoundry Global Education & Learning Series – Compilers.
To practice all areas of Compilers for Interviews, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check Compiler Design Books
- Apply for Computer Science Internship
- Check Computer Science Books
- Practice MCA MCQs
- Practice Computer Science MCQs