Search | | Contact Us | Resource Center Login | Home|

What is the result of %char(2764)?


a. the lowercase letter d

b. a black heart character

c. the ASCII character whose value is decimal 204

d. a runtime error


Correct answer: (c)



The %CHAR system-supplied subroutine returns the character that corresponds to the value passed.  The number 2764 is the hex value of the Unicode black heart glyph (b), but %CHAR does not support Unicode.  Instead, %CHAR returns the ASCII character whose value corresponds to the low-order byte of the numeric value passed, as it would be expressed in an integer.  If the value 2764 were in hexadecimal, that would be 64, which is a lowercase letter d (a).  But the argument does not have a ^x() around it, so it is decimal.  That means that the value used will be 2764 modulo 256 (in decimal), which is decimal 204.  Thus, (c) is the correct answer.

More information about News and Events

Contact Synergex to learn more about  News and Events