Which of the following hexadecimal constants match the regular expression…

2025

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

Attempted by 54 students.

Show answer & explanation

Correct answer: A

The regular expression 0x[0-9A-F]+ requires a '0x' prefix followed by one or more uppercase hexadecimal digits (0-9, A-F). Option 0 ('0x4C5') matches this pattern exactly. Other options fail due to lowercase letters, missing prefixes, or invalid characters.

Explore the full course: Isro