My blog has been moved to ariya.ofilabs.com.

Friday, November 25, 2005

Seven-Segment Problem

After too long working on a prototype board, I had an idea to invent this question.

.

You have a 7-segment display. A byte is sent to the display, 7 bits are used to switch on (if the bit is set) or switch off (if the bit is reset) the segments. One bit in this byte is not used and always zero.

Values in the byte which correspond to decimal number (0 to 9) shown in the display are summarized as follows:

  "0"    0xE7 
  "1"    0x22 
  "2"    0xAD 
  "3"    0xAB 
  "4"    0x6A 
  "5"    0xCB 
  "6"    0xCF 
  "7"    0xA2 
  "8"    0xEF 
  "9"    0xEB 

Find out what value you must send so that the display shows "E".

In an interview, see how fast your candidate can get the answer (of course, you can replace "E" with another letter). Also, if he or she spends too much time studying number "8", time to try another candidate...

7 comments:

Ben Meyer said...

0xCD?

sharko said...

with "8" you have the "death" bit
"8" => EF = 1110 1111

"E" is invers command of "1"
"1" => 22 = 0010 0010

"E" => 1101 1101
with the "death" bit

"E" = 1100 1101
"E" = CD

ruurd said...

'8' and (not '1'))

budi said...

Whatever produces "8" XOR with whatever produces "1"? (I am kind of lazy thinking right now. Ha ha ha.)

dheche said...

And how about if the candidate not answer the question, instead of discover that 4 is not activated by 0x6A ?

quidome said...

Isn't it just the value of 8 minus the value of 1?

EF - 22 = CD

tincan said...

-|The long way|-

-1-
2-3
-5- = Bit Assignments
6-7
-8-

"E" = Bit's 1,2,5,6,8 = 1100 1101 = CD