Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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?

Answers were Sorted based on User's Feedback



52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to cou..

Answer / tyutyjtytydf

#include<stdio.h>
#include<conio.h>
main()
{
if(puts("hello world"))
{}
}

Is This Answer Correct ?    10 Yes 0 No

52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to cou..

Answer / sainath

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 ?    6 Yes 0 No

52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to cou..

Answer / ss

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

}
}

Is This Answer Correct ?    6 Yes 1 No

52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to cou..

Answer / amogh

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 ?    5 Yes 2 No

52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to cou..

Answer / hussain reddy

/* mypro.c*/
#include<stdio.h>
void main()
{
remove("mypro.c");
}

Is This Answer Correct ?    3 Yes 0 No

52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to cou..

Answer / lokesh n. jaliminche

/*program to check if number is power of 2
#include <stdio.h>

unsigned int check_power(unsigned int value)
{
unsigned int count = 0;
while (value > 0) {
if ((value & 1) == 1)
count++;
value >>= 1;
}
return count;
}
int main()
{
unsigned int n, count;
printf("Enter the number \n");
scanf("%d",&n);
count=check_power(n);
if(count == 1)
{
printf("number is power of 2\n");
}
else
{
printf("number is not power of 2\n");
}
printf("set bits == %d",count);
}

Is This Answer Correct ?    0 Yes 0 No

52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to cou..

Answer / lokesh n. jaliminche

#include <stdio.h>

unsigned int check_power(unsigned int value)
{
unsigned int count = 0;
while (value > 0) {
if ((value & 1) == 1)
count++;
value >>= 1;
}
return count;
}
int main()
{
unsigned int n, count;
printf("Enter the number \n");
scanf("%d",&n);
count=check_power(n);
if(count == 1)
{
printf("number is power of 2\n");
}
else
{
printf("number is not power of 2\n");
}
printf("set bits == %d",count);
}

Is This Answer Correct ?    0 Yes 0 No

52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to cou..

Answer / sankar kiran

#include<stdio.h>
#include<conio.h>
void main()
{
while(printf("Hello World"))
{
break;
}
getch();

}

Is This Answer Correct ?    6 Yes 8 No

52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to cou..

Answer / swastisundar bose

52.
#include<stdio.h>
void main(){
if("Hello World")
{

}
}

Is This Answer Correct ?    17 Yes 20 No

Post New Answer

More C Interview Questions

Write a program that accepts a string where multiple spaces are given in between the words. Print the string ignoring the multiple spaces. Example: Input: “ We Are Student “ Output: "We Are Student"

1 Answers  


Explain how can I right-justify a string?

0 Answers  


write a program that accepts 3 numbers from the user. dispaly the values in a descending order.

3 Answers  


What is mean by data types in c?

0 Answers  


What is the right way to use errno?

0 Answers  


What is volatile c?

0 Answers  


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

0 Answers  


Differentiate call by value and call by reference?

0 Answers   Cyient,


Explain the use of 'auto' keyword

0 Answers  


What are predefined functions in c?

0 Answers  


What is a scope resolution operator in c?

0 Answers  


Is a house a mass structure?

0 Answers  


Categories