ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Find Index of least significant bit set in an Integer. ex.
int value is say 10001000 results should be 4.
 Question Submitted By :: Bhagwat
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Find Index of least significant bit set in an Integer. ex. int value is say 10001000 results should be 4.
Answer
# 1
I think the following code will help!!!!!!
#include<stdio.h>
main()
{
int a,count=0;
scnaf("%d",&a);
while(a)
{
if(a&1==1)
{
printf("%d",++count);
break;
}
a=a>>1;
++Count;
}
return;
}
 
Is This Answer Correct ?    1 Yes 0 No
Supri
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
2.main { int x,j,k; j=k=6;x=2; x=j*k; printf("%d", x); HCL6
please give me some tips for the selection in TCS. TCS3
what is the diff between the printf and sprintf functions?? and what is the syntax for this two functions ??  4
What is structure padding ? HP1
#define f(x) main() { printf("\n%d",f(2+2)); }  3
how we can make 3d venturing graphics on outer interface Microsoft1
How can I invoke another program from within a C program?  1
How would you find a cycle in a linked list?  2
Write a program for deleting duplicate elements in an array Subex1
write a code for large nos multilication (upto 200 digits) Persistent1
12. Look at the Code: main() { int a[]={1,2,3},i; for(i=0;i<3;i++) { printf("%d",*a); a++; } } Which Statement is/are True w.r.t the above code? I.Executes Successfully & Prints the contents of the array II.Gives the Error:Lvalue Required III.The address of the array should not be changed IV.None of the Above. A)Only I B)Only II C)II & III D)IV Accenture4
a memory of 20 bytes is allocated to a string declared as char *s then the following two statements are executed: s="Etrance" l=strlen(s); what is the value of l ? a.20 b.8 c.9 d.21 TCS2
Give the output for the following program. #define STYLE1 char main() { typedef char STYLE2; STYLE1 x; STYLE2 y; clrscr(); x=255; y=255; printf("%d %d\n",x,y); } ADITI1
logic for generating all the combinations of the any number of given letters. ex::::::::: if a,b,c,d are given the o/p should be abcd,dcba,dbac,bcad,................ 4*3*2*1 combinations............ Infosys1
Given an array of length N containing integers between 1 and N, determine if it contains any duplicates.  2
long int size a) 4 bytes b) 2 bytes c) compiler dependent d) 8 bytes HCL10
What are Storage Classes in C ? HP6
How can I convert integers to binary or hexadecimal?  2
write a program for odd numbers?  5
write a C code to reverse a string using a recursive function, without swapping or using an extra memory. Motorola2
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com