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  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
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
how to find a 5th bit is set in c program
 Question Submitted By :: Anilkumar
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how to find a 5th bit is set in c program
Answer
# 1
#include<stdio.h>
#include<conio.h>

int main()
{
	int number;
	int position;
	int result;

	printf("Enter the Number\n");
	scanf("%d",&number);
	printf("Enter the Position\n");
	scanf("%d",&position);

	result = (number >>(position-1));

	if(result & 1)
		printf("Bit is Set");
	else
		printf("Bit is Not Set");
}
 
Is This Answer Correct ?    2 Yes 2 No
Santhi Perumal
 
  Re: how to find a 5th bit is set in c program
Answer
# 2
#include<stdio.h>
void main()
{
int a;
a=a>>4;
if(a%2==1)
printf("the bit is set");
else
printf("the bit is not set");
}
 
Is This Answer Correct ?    1 Yes 1 No
Rajkumar
 
 
 
  Re: how to find a 5th bit is set in c program
Answer
# 3
main()
{
int n;
printf("enter n:");
scanf("%d",&n);
if(n&(1<<5);
printf("5th bit in %d is set",n);
}
 
Is This Answer Correct ?    0 Yes 0 No
Valli
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
wats the diference btwen constant pointer and pointer to a constant.pls give examples.  6
4.weight conversion: Write a program that will read weight in pounds and convert it into grams.print both the original weight and the converted value.There are 454 grams in a pound.design and carry out a test plan for this program. Wipro1
When you call malloc() to allocate memory for a local pointer, do you have to explicitly free() it?  2
write a program to swap bits in a character and return the value prototype of function char fun (char a, charb flag c) where fun returns a char, char a is a the value char b is the bit to be changed and flag c is the bit value for eg: x=fun(45,7,0) since 45 is 0010 0101 and ow x should contain the value 65 (0110 0101) Bosch1
what is the advantage of using SEMAPHORES to ORDINARY VARIABLES??? NSN1
what is the difference between const volatile int i & volatile const int j; HCL2
The C language terminator is a.semicolon b.colon c.period d.exclamation mark TCS3
How can I allocate arrays or structures bigger than 64K?  4
what is real time system?what is the differance between hard and soft real time systems  2
write a program structure to find average of given number  1
what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){ case 4:a+=a*r; case 3:a+=a*r; case 2:a+=a*r; case 1:a+=a*r; } } a.computes simple interest for one year b.computes amount on compound interest for 1 to 4 years c.computes simple interest for four year d.computes compound interst for 1 year TCS4
int main() { int *p=new int; *p=10; del p; cout<<*p; *p= 60; cout<<*p; } what will be the output & why? TCS4
long int size a) 4 bytes b) 2 bytes c) compiler dependent d) 8 bytes HCL11
#include<stdio.h> int fun(); int i; int main() { while(i) { fun(); main(); } printf("hello \n"); return 0; } int fun() { printf("hi"); } answer is hello.how??wat is tat while(i) mean? Intel4
main() { clrscr(); } clrscr(); ME3
What is the diffences between Windows XP and Windows Visa Aricent1
What is meaning of "Void main" in C Language. TCS8
#define swap1(a,b) a=a+b;b=a-b;a=a-b; main() { int x=5,y=10; swap1(x,y); printf("%d %d\n",x,y); swap2(x,y); printf("%d %d\n",x,y); } int swap2(int a,int b) { int temp; temp=a; b=a; a=temp; return; } what are the outputs? Ramco4
How would you find a cycle in a linked list?  2
write a string copy function routine?  1
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

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