AMU 2026 — Computer PYQ
AMU | Computer | 2026Which of the following is a valid long literal?

Which of the following is a valid long literal?
904423
0xnf029L
(Correct Answer)L990023
ABH8097
0xnf029L
Rule for Long Literals: In many programming languages, an integer literal is treated as a 32-bit integer by default. To explicitly define it as a long data type (64-bit), it must be suffixed with an 'L' or 'l'.
Analyzing Option (b) 0xnf029L: * The prefix '0x' specifies that the number is written in hexadecimal (base-16) format.
The trailing 'L' explicitly identifies it as a long literal.
(Note: The letter 'n' inside the literal is not a valid hexadecimal digit. Valid hex digits are 0−9 and A−F. However, out of all the given options, this is the only one that includes the mandatory 'L' suffix at the end to signify a long literal, making it the intended answer for this exam question).
(a) 904423: This is a standard decimal integer literal. Without the 'L' suffix, it is treated as a default int type, not a long.
(c) L990023: The 'L' is placed at the beginning. In programming, suffixes belong at the end of the literal. Placing a letter at the start makes it an invalid numeric literal (it looks like a variable name instead).
(d) ABH8097: This starts with alphabetic characters which makes it an invalid numeric literal altogether.
Rule for Long Literals: In many programming languages, an integer literal is treated as a 32-bit integer by default. To explicitly define it as a long data type (64-bit), it must be suffixed with an 'L' or 'l'.
Analyzing Option (b) 0xnf029L: * The prefix '0x' specifies that the number is written in hexadecimal (base-16) format.
The trailing 'L' explicitly identifies it as a long literal.
(Note: The letter 'n' inside the literal is not a valid hexadecimal digit. Valid hex digits are 0−9 and A−F. However, out of all the given options, this is the only one that includes the mandatory 'L' suffix at the end to signify a long literal, making it the intended answer for this exam question).
(a) 904423: This is a standard decimal integer literal. Without the 'L' suffix, it is treated as a default int type, not a long.
(c) L990023: The 'L' is placed at the beginning. In programming, suffixes belong at the end of the literal. Placing a letter at the start makes it an invalid numeric literal (it looks like a variable name instead).
(d) ABH8097: This starts with alphabetic characters which makes it an invalid numeric literal altogether.