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 / g
54:
you can load the source file to memory at the beginning of
the run using mmap(), or using one of the countless methods
to read from file in C and storing the data in a string
array, then it won't matter if the file is deleted, you can
always re-create it using the data in the process memory.
53/55: answering 53 also answers 55.
53:
int checkBits(x){
numOfOnes=0;
do{
if((x%2)!=0)
{numOfOnes++;}
x=x/2;
}while (x!=0);
return numOfOnes;
}
55:
int checkPower(x){
if(checkBits(x)==1)
{return 1;}
else{return 0;}
}
| Is This Answer Correct ? | 18 Yes | 22 No |
Post New Answer View All Answers
How is null defined in c?
Why do we use static in c?
What does %c do in c?
Is flag a keyword in c?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
Explain how do you determine a file’s attributes?
What are the different types of control structures?
What does. int *x[](); means ?
What is the purpose of ftell?
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }
What are the differences between Structures and Arrays?
What is difference between stdio h and conio h?
How do we print only part of a string in c?
What is character set?
What is static and auto variables in c?