IAE Academy

ISRO CS 2025 Q.28: solution and answer

ISRO 2025 · CSQ.28 · 1 mark · MCQ

Which of the following hexadecimal constants match the regular expression given? (0x[0-9A-F]+)

  1. (A)

    0x4C5

  2. (B)

    0x50b

  3. (C)

    04A

  4. (D)

    0x

See the question in the paper

Answer and solution

ANSWER

Only option (A), 0x4C5, matches the expression.

Official answer: ASource: ISRO's final answer key of 15 May 2026

  1. The expression 0x[0-9A-F]+ is the literal prefix 0x, followed by one or more characters, each of which is a digit 0-9 or an uppercase letter A-F.

  2. The character class [0-9A-F] is case-sensitive, so lowercase letters a-f are not in it.

  3. The + requires at least one character after the prefix, so the prefix alone is not enough.

  4. (a) 0x4C5: prefix 0x, then 4, C, 5, all in the class. It matches.

  5. (b) 0x50b: the last character b is lowercase, so it is not in [0-9A-F]. It does not match.

  6. (c) 04A: it begins with 04, not the literal 0x. It does not match.

  7. (d) 0x: nothing follows the prefix, so + is not satisfied. It does not match.

  8. Only (a) matches.

KEY IDEA

Read a regular expression piece by piece: literal prefix, character class (case-sensitive), then the quantifier + meaning at least one character.

WATCH OUT FOR

Treating [0-9A-F] as if it also accepted lowercase hex digits (so choosing 0x50b), or accepting the bare prefix 0x although + demands at least one digit.

From the ISRO CS 2025 paper. Every question of this paper · The full paper (PDF, ISRO) · All 5 ISRO Finite automata questions, with notes

More ISRO Finite automata questions