In some programming languages, an identifier is permitted to be a letter…

2017

In some programming languages, an identifier is permitted to be a letter followed by any number of letters or digits. If L and D denotes the set of letters and digit respectively. Which of the following expression defines an identifier?

  1. A.

    (L + D) *

  2. B.

    (L.D) *

  3. C.

    L(L + D) *

  4. D.

    L(L.D) *

Attempted by 95 students.

Show answer & explanation

Correct answer: C

An identifier must start with a letter (L). Following this, it can contain any number of letters or digits ((L + D)*). Therefore, the regular expression defining an identifier is L(L + D)*.

Explore the full course: Isro