Chelsio Communications Interview Question for Software Engineer / Developers






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

int a = 500;
//Take the first byte of this integer
char *b = (char *)a;
int c = (int)*b;

//Now c will have the first byte of a
//count the number of bits that are set

while(c !=0)
{
c = c & (c -1);
count++;
}

return count;

- Nipun June 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a=100,count=0,i=0;
for(;i<16;i++)
{

if(a&1==1)
count++;
a=a>>1;
}
cout<<count;
getch();
}

- naganathan June 24, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I have tried both.But i dint get the proper output

- Ran November 24, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

// C program to Count set 
// bits in an integer  
#include <stdio.h>        
  
/* Function to get no of set bits in binary 
   representation of positive integer n */
unsigned int countSetBits(unsigned int n) 
{ 
  unsigned int count = 0; 
  while (n) 
  { 
    count += n & 1; 
    n >>= 1; 
  } 
  return count; 
} 
  
/* Program to test function countSetBits */
int main() 
{ 
    int i = 9; 
    printf("%d", countSetBits(i)); 
    return 0; 
}

- infomaniac May 01, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

// C program to Count set 
// bits in an integer  
#include <stdio.h>        
  
/* Function to get no of set bits in binary 
   representation of positive integer n */
unsigned int countSetBits(unsigned int n) 
{ 
  unsigned int count = 0; 
  while (n) 
  { 
    count += n & 1; 
    n >>= 1; 
  } 
  return count; 
} 
  
/* Program to test function countSetBits */
int main() 
{ 
    int i = 9; 
    printf("%d", countSetBits(i)); 
    return 0; 
}

- infomaniac May 01, 2019 | 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