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 Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

a value that does not change during program execution a) variabe b) argument c) parameter d) none

699


What is register variable in c language?

609


How main function is called in c?

633


What is a macro?

659


What is the condition that is applied with ?: Operator?

667






What is the difference between text and binary modes?

650


any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()

697


What is unsigned int in c?

563


#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }

776


I need previous papers of CSC.......plz help out by posting them.......

1818


What is the difference between procedural and declarative language?

657


Explain the difference between getch() and getche() in c?

567


Can we increase size of array in c?

544


What is a volatile keyword in c?

643


Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent

1432