A

Admin • 833K Points
Coach

Q. A hexadecimal literal begins with

  • (A) 00
  • (B) 0x
  • (C) 0X
  • (D) Both 0x and 0X
  • Correct Answer - Option(D)
  • Views: 23
  • Filed under category JavaScript
  • Hashtags:

Explanation by: Admin

The correct answer is:

(D) Both 0x and 0X

Explanation:

In most programming languages (such as C, C++, Java, JavaScript, and Python), a hexadecimal literal starts with either 0x or 0X. Both notations are valid and indicate that the number is in hexadecimal (base 16) format.

Examples:

  • 0x1A3F (Hexadecimal representation of 6719 in decimal)
  • 0XFF (Hexadecimal representation of 255 in decimal)

Thus, the correct answer is (D) Both 0x and 0X.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.