0

I have seen this question unanswered in an interview experience

first of all, I need to understand the question,

(a nibble corresponds to single hex character right?) so, if given Hex string "12A" then the output should be

arr[0]=0001
arr[1]=0010
arr[2]=1010

is that correct or have i misunderstood?

if so how do i go about implementing this in C#? whats the type of arr here?

Salma Nafady
  • 331
  • 4
  • 15
  • I think your last question there is a question for the one that interviews you. It could be string, it could be a numeric type. The format suggests numeric, but it also suggest base 10 notation, which is wrong/odd. – Lasse V. Karlsen Nov 04 '13 at 10:48

1 Answers1

2

A nibble is a four bit binary. As such you need three nibbles to represent 12A.

The arr you have there is incorrect - as there is no 2 in binary.

arr[0]=0001
arr[1]=0010
arr[2]=1010

For c# implementation see - How can you nibble (nybble) bytes in C#?

Community
  • 1
  • 1
Kami
  • 19,134
  • 4
  • 51
  • 63