Topic: Theory of Computation
Which of the following hexadecimal constants match the regular expression given?
$(0x[0-9A-F]+)$
- A. $0x4C5$
- B. $0x50b$
- C. 04A
- D. 0x
Answer: A. $0x4C5$
Explanation: The regular expression specifies the string must start with '0x', followed by one or more (+) characters from the set 0-9 or uppercase A-F. Option (b) contains a lowercase 'b', violating the character class. Option (c) lacks the '0x' prefix. Option (d) lacks the trailing hexadecimal digits. Option (a) perfectly matches.