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                      
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
52.write a “Hello World” program in “c” without using a
semicolon?
53.Give a method to count the number of ones in a 32 bit number?
54.write a program that print itself even if the source file
is deleted?
55.Given an unsigned integer, find if the number is power of 2?
 Question Submitted By :: Avula_sujatha@yahoo.co.in
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to count the number of ones in a 32 bit number? 54.write a program that print itself even if the source file is deleted? 55.Given an unsigned integer, find if the number is power of 2?
Answer
# 1
52.
#include<stdio.h>
void main(){
 if("Hello World")
  {
  
  }
}
 
Is This Answer Correct ?    11 Yes 11 No
Swastisundar Bose
 
  Re: 52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to count the number of ones in a 32 bit number? 54.write a program that print itself even if the source file is deleted? 55.Given an unsigned integer, find if the number is power of 2?
Answer
# 2
53.
'num' is 32 bit integer
count=0;
for(;num!=0;count++)
num&=num-1;

55.

if(num&(num -1) == 0)
printf("%d is power of 2",num);
 
Is This Answer Correct ?    3 Yes 2 No
Amogh
 
 
 
  Re: 52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to count the number of ones in a 32 bit number? 54.write a program that print itself even if the source file is deleted? 55.Given an unsigned integer, find if the number is power of 2?
Answer
# 3
#include<stdio.h>
#include<conio.h>
void main()
{
while(printf("Hello World"))
{
break;
}
getch();

}
 
Is This Answer Correct ?    2 Yes 6 No
Sankar Kiran
 
  Re: 52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to count the number of ones in a 32 bit number? 54.write a program that print itself even if the source file is deleted? 55.Given an unsigned integer, find if the number is power of 2?
Answer
# 4
A small correction in the above answer. Use if condition as
shown below.

#include<stdio.h>
void main()
{
   if(printf(%s, "Hello World"))
   {
   }
}


Answer for the last ques. i.e no. 55

unsigned int x;
if(x < 0)      //Error checking only. Unsigned int shudn't 
//have a negative value
   return 0;
else
   return !(x $ (x-1));

The logic here is, if we do bitwise 'and' with two
consecutive numbers, the greater of which is a power of 2
then the answer is 0.
Eg. 8 - 1000
  8-1 - 0111
and & - 0000
 
Is This Answer Correct ?    4 Yes 0 No
Sainath
 
  Re: 52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to count the number of ones in a 32 bit number? 54.write a program that print itself even if the source file is deleted? 55.Given an unsigned integer, find if the number is power of 2?
Answer
# 5
#include<stdio.h>
#include<conio.h>
main()
{
if(puts("hello world"))
{}
}
 
Is This Answer Correct ?    2 Yes 0 No
Tyutyjtytydf
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; } Honeywell2
What kind of sorting is this? SORT (k,n) 1.[Loop on I Index] repeat thru step2 for i=1,2,........n-1 2.[For each pass,get small value] min=i; repeat for j=i+1 to N do { if K[j]<k[min] min=j; } temp=K[i];K[i]=K[min];K[min]=temp; 3.[Sorted Values will be returned] A)Bubble Sort B)Quick Sort C)Selection Sort D)Merge Sort Accenture3
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
main() {int a=200*200/100; printf("%d",a); } TCS7
Can we access RAM? How? Whats the range of access? Similarly What are other hardware we can access?  1
What is C language Terminator? TCS12
How can I implement opaque (abstract) data types in C? What's the difference between these two declarations? struct x1 { ... }; typedef struct { ... } x2;  2
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 Alcatel8
What does a run-time "null pointer assignment" error mean?  2
How would you write qsort?  1
void main() { int s[4][2]={ {1234,56},{1212,33},{1434,80},{1312,78} }; int (*p)[2]; int i,j,*pint; for(i=0;i<=3;i++) { p=&s[i]; pint=p; printf("\n"); for(j=0;j<=1;j++) printf("%d",*(pint+j)); } } while running this program it shows a warning-suspicious pointer conversion ie pint=p; my que is why should we assign the value of p to pint again.why cant we use it directly as *(p+j)..but if i use like tat the o/p is garbage value..  1
How can I convert integers to binary or hexadecimal?  2
can anyone please tell me wat is backlogs... i was looking for the job openings where i read this.. eligibility criteria minimum 70% in degree without backlogs. is that arrear.. if so is it standing arrear or history of arrears... please help me...  4
How can I read a directory in a C program? Wipro1
what is real time system?what is the differance between hard and soft real time systems  2
value = 0xabcd; for (loop = 1; (value >> 1) & 1 | loop & 1; loop++) { foo(); if (loop & 1) value >>= 1; } how many times is foo() executed? Google5
User define function contain thier own address or not.  2
Main must be written as a.the first function in the program b.Second function in the program c.Last function in the program d.any where in the program TCS12
#include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) malloc(25); strcpy(p1,"Ramco"); strcpy(p2,"Systems"); strcat(p1,p2); printf("%s",p1); } Tell me the output? Ramco5
Why the use of alloca() is discouraged? Oracle2
 
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