:: Home Page            
 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                      
Categories >> Software >> Programming Languages >> C


 C interview questions  C Interview Questions (2248)
 C++ interview questions  C++ Interview Questions (1106)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (644)
Write a C program to convert an integer into a binary 
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
  Re: Write a C program to convert an integer into a binary string?
# 1
char *IntToBinString(int no);
int no;
printf("ENTER THE NO: ");
printf("\nBINARY O/P STRING:\n%s",IntToBinString(no));
char *IntToBinString(int no)
char *ptr;
int i, size;
size = sizeof(int)*8;
ptr = (char *)malloc(sizeof(int)*8);
for(i = size - 1; i >= 0; i--)
if(no >> i & 0x01)
*ptr++ = 49;
*ptr++ = 48;
*ptr = '\0';
return (ptr - size);
Is This Answer Correct ?    9 Yes 3 No

Other C Interview Questions
  Question Asked @ Answers
What are the preprocessors? HP 6
out put of printf(“%d”,printf(ram));   5
main() { int i=0; while(+(+i--)!=0) i-=i++; printf(i); }   3
Write a program which take a integer from user and tell whether the given variable is squar of some number or not. eg: is this number is 1,4,9,16... or not Alcatel 9
what is the difference between #include<> and #include”…”?   4
Write a program in c using only loops to print * * * * * ******* Ibm 2
What is Your Name :)   1
18)struct base {int a,b; base(); int virtual function1(); } struct derv1:base{ int b,c,d; derv1() int virtual function1(); } struct derv2 : base {int a,e; } base::base() { a=2;b=3; } derv1::derv1(){ b=5; c=10;d=11;} base::function1() {return(100); } derv1::function1() { return(200); } main() base ba; derv1 d1,d2; printf("%d %d",d1.a,d1.b) o/p is a)a=2;b=3; b)a=3; b=2; c)a=5; b=10; d)none 19) for the above program answer the following q's main() base da; derv1 d1; derv2 d2; printf("%d %d %d",da.function1(),d1.function1(),d2.function1 ()); o/p is a)100,200,200; b)200,100,200; c)200,200,100; d)none 20)struct { int x; int y; }abc; you can not access x by the following 1)abc-->x; 2)abc[0]-->x; abc.x; (abc)-->x; a)1,2,3 b)2&3 c)1&2 d)1,3,4   1
There are 3 baskets of fruits with worng lables,one basket has apple,another basket has orange,another has combination of apple and orange,what is the least way of interchange the lables. Google 14
write a c/c++ program that takes a 5 digit number and calculates 2 power that number and prints it?   4
swapping of two numbers without using third variable using AND and OR operators   2
how to print 2-D array using a single for loop? Value-Labs 2
For more C Interview Questions Click Here 

Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
Copyright © 2013  All Rights Reserved.   ::