Regular expression a + b denotes the set:
Regular expression a + b denotes the set:
Answer: C. {a,b} — In the context of regular expressions and formal language theory: The + operator (also written as | or U) represents UNION or logical OR. a denotes the set…
- A.
{a}
- B.
{∈, a, b}
- C.
{a,b}
- D.
None of these
Attempted by 447 students.
Show answer & explanation
Correct answer: C
In the context of regular expressions and formal language theory:
The + operator (also written as | or U) represents UNION or logical OR.
a denotes the set containing only the string "a", which is {a}.
b denotes the set containing only the string "b", which is {b}.
Therefore, a + b means the union of these two sets: {a} \cup {b}, which results in the set {a, b}. It matches either the string "a" or the string "b".
Loading lesson…