Amazon Interview Question
Software Engineer in Tests Software Engineer / DevelopersIf I understand correctly, the question is:
If you have to print the character out in ASCII format, what should you ask yourself first?
That question should be: Is the given string (that is in Hex) is already encoded in ASCII or not?
If each character uses 1 byte, it is very likely that it is already in ASCII.
I see whats going on with this question- I looked up the meaning of ASCII- its an encoding format that uses 7 bits - it can be represented by binary, decimal, hexadecimal etc. So if we are given a hex string, then as isara hinted, the question would be what is the input format ? I guess that depends on the Hardware/system that is used to feed the input!
Initially I got the impression that what was being asked was something like atoi().
actually hex A is different from character 'A'.
- aj April 16, 20090xA = 10 = '\n'
'A' = 41 = 0x29