Test: Regular Expression


15 Questions MCQ Test Compiler Design | Test: Regular Expression


Description
This mock test of Test: Regular Expression for Computer Science Engineering (CSE) helps you for every Computer Science Engineering (CSE) entrance exam. This contains 15 Multiple Choice Questions for Computer Science Engineering (CSE) Test: Regular Expression (mcq) to study with solutions a complete question bank. The solved questions answers in this Test: Regular Expression quiz give you a good mix of easy questions and tough questions. Computer Science Engineering (CSE) students definitely take this Test: Regular Expression exercise for a better result in the exam. You can find other Test: Regular Expression extra questions, long questions & short questions for Computer Science Engineering (CSE) on EduRev as well by searching above.
QUESTION: 1

A regular expression enables a quick test to determine objects and text strings with undependable values.

Solution:

Explanation: Because it checks for all the values and determines whether the output string matches with the given string.

QUESTION: 2

RE can be used only for values of type string and number.

Solution:

 No not for all values the string and numbers can we use the RE.

QUESTION: 3

You can use RE, if you expect the value of a property to change in an unpredictable way each time its run.

Solution:

Explanation: For every cycle the values does not change unpredictably because the type of grammar that it accepts is defined.

QUESTION: 4

All ___________ Are automatically treated as regular expressions.

Solution:

Explanation: The programmatic description is genuinely treated as regular expression.

QUESTION: 5

If a ‘/’ is used before a character that has no special meaning, ‘/’ is ignored.

Solution:

Explanation: The backslash carries no significance and it is ignored.

QUESTION: 6

The regular expression denote a language comprising all possible strings of even length over the alphabet (0, 1)

Solution:

Explanation: Option A does not consider even length criteria for the question.
Option B 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 C it gives either 1 or 0.
Hence Option D is the answer.

QUESTION: 7

The RE gives none or many instances of an x or y is

Solution:

Explanation: Whether x or y is denoted by x+y and for zero or more instances it is denoted but (x+y)*.

QUESTION: 8

The RE in which any number of 0′s is followed by any number of 1′s followed by any number of 2′s is

Solution:

Explanation: The order for the desired string is 012 and foe any number of 0s we write 0* for any number of 1s we denote it by 1* and similarly for 2*.Thus 0*1*2*.

QUESTION: 9

The regular expression have all strings of 0′s and 1′s with no two consecutive 0′s is :

Solution:

From the former bracket we choose 0 or epsilon. Then from the latter part 1 or 10 which can be followed by 1 or 10.

QUESTION: 10

The regular expression with all strings of 0′s and 1′s with at least two consecutive 0′s is:

Solution:

Explanation: The expression (0+1)*00(0+1)* is where either it initially takes 0 or 1 or 00 followed by string of combination of 0 and 1.

QUESTION: 11

 Which of the following is NOT the set of regular expression R = (ab + abb)* bbab

Solution:
QUESTION: 12

String generated byS->aS/bA,A->d/ccA

Solution:

Explanation: S->aS (substitute S->aS)
S->aaS (substitute S->bA)
S->aabA (substitute A->ccA)
S->aabccA (substitute A->d)
S->aabccd.

QUESTION: 13

Consider the production of the grammar S->AA A->aa A->bb Describe the language specified by the production grammar.

Solution:

Explanation: S->AA (substitute A->aa)
S->aaaa
S->AA (substitute A->aa )
S->aaA (substitute A->bb)
S->aabb
S->AA (substitute A->bb the A->aa)
S->bbaa
S->AA (substitute A->bb)
S->bbbb.

QUESTION: 14

If R is regular language and Q is any language (regular/ non regular), then Pref (Q in R) is _____________

Solution:

Explanation: So says the definition of Regular Grammar.

QUESTION: 15

The production of the form non terminal → Λ is said to be null production.

Solution:

The productions of type ‘A -> λ’ are called λ productions ( also called lambda productions and null productions) . These productions can only be removed from those grammars that do not generate λ (an empty string). It is possible for a grammar to contain null productions and yet not produce an empty string.

Related tests