Expedia Interview Question for Software Engineer / Developers


Country: United States
Interview Type: Written Test




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

// Shift right 3 spaces to get 4th bit into 1st least significant bit
// Bitwise & with 0001 to get result.

int bitAtPos(int num) {
return (1 & (num >> 3));
}

- Jon August 27, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

(zoomba)x = str(20,2)
10100 // String
(zoomba)x[-4]
0 // Character
(zoomba)

That is one way. Another is trivial using bit manipulation.

- NoOne April 18, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int leastSignificantBitAtPosition(int num)
{
return (num & (1 << 4)) // As it was specified as 4th LSB bit
}

- Harika June 12, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int leastSignificantBit(int num)
{
return (num & (1 << 4)) // needed 4 th LSB bit
}

- Harika June 12, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int bitAtPosition(int num)
{
return (num & (1 << 4)); //as needed 4 th LSB
}

- Harika June 12, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Wrong

- Anonymous June 14, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

For 4th least significant use num<<3

- Anonymous June 14, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

// Java Implementation for kth LSB

void function(int n, int k)  {
		System.out.println((n&(1<<(k-1)));
	}

- Kapil July 09, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

(n/8)%2

- Anonymous June 09, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

int bitAtPosition(int num)
{
	mask_bit = 1 << 4; //required 4th LSB
	if (num & bit)
		return 1;
	else 
		return 0;	
}

- Harika June 12, 2017 | 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