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]+)
- A.
0x4C5
- B.
0x50b
- C.
04A
- 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.