One97 Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

byte ReverseBits(byte b)
        {
            byte maxByte = 0x80;

            byte reverseChar = 0;
            byte powersOfTwo = 1;
            for (int i = 0; i < 8; i++, maxByte >>= 1, powersOfTwo <<= 1)
            {
                reverseChar += (byte)((b & maxByte) > 0 ? powersOfTwo : 0);
            }

            return reverseChar;
        }

- sv February 08, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

how about:

x = ~a & 0xff;

- anom March 30, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I dont think its working.... :o

- Abhi August 17, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Python Code

{{
def func(number):
"""Function func take number as argument and return reverse byte string
"""
b_num = bin(number)[2:]
return b_num[::-1]
}}

- Ankit February 26, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

unsigned char reverseBits(char c){
    unsigned char ch = (unsigned char)c;
    unsigned char csol = 0;
    cout << int(ch) << endl;
    while(ch){
        csol = csol | (ch & 1);
        csol <<= 1;
        ch >>= 1;
    }
    return (csol>>1);
}

- swapnilsj August 06, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

char reverseBits(char ch) {
		int out=0;
			int in=(int)ch;
			for (int i = 0; i < 16; i++) {
				if( is_set(in, i) ) { 
				 out=set_bit(out, 15-i);
				}
			}
		return (char)out;
	}

	/** is bit[i] set */
	boolean is_set(int x, int b) {
		return ((x & (1 << b)))==(1<<b) ? true: false; 
	}

	/** set bit[i] to 1 */
	int set_bit(int y, int b) {
		return y | (1 << b); // set the bit on, logical OR
	}

- vortexsbkny October 01, 2016 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More