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
Answer / sivajyothi katireddi
55:
if(num & (num-1) == 0)
{
printf("num is power of 2\n");
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / deepak kumar
#include<stdio.h>
main()
{
while(printf("hello world"))
{
}
return(0);
}
| Is This Answer Correct ? | 3 Yes | 2 No |
Answer / rajeev
#include<stdio.h>
main()
{
if(printf("Hello world \n"))
{
}
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / rajat sharan
#include<stdio.h>
main()
{
if (printf(hello world))
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / anshukumarsrivastava.
a program to print a string i am in allahabad without using
a semicolon.
#include<stdio.h>
#include<conio.h>
void main()
{
if(printf(" i am in allahabad"))
getch();
}
| Is This Answer Correct ? | 4 Yes | 4 No |
Answer / jareesh
//answer for 53
#include "stdafx.h"
void _tmain(int argc, _TCHAR* argv[])
{
if (printf("hi")){}
}
//I tested in win32 console program, worked perfect.
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / manjusha k
#include<stdio.h>
#include<conio.h>
void main()
{
if(printf("hello world")){
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ukrocky
Write Hello World Without using Hello World From Ukrocky
#include<iostream.h>
void main()
{
int a[12]={72,101,108,108,111,32,87,111,114,108,100,0};
for(int i=0; i<12; i++)
{
cout<<char(a[i]);
}
cout<<endl;
}
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / 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 |
Define the scope of static variables.
Write one statement equalent to the following two statements x=sqr(a); return(x); Choose from one of the alternatives a.return(sqr(a)); b.printf("sqr(a)"); c.return(a*a*a); d.printf("%d",sqr(a));
what are # pragma staments?
write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34
What is a null pointer in c?
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
proc() { static i=10; printf("%d",i); } If this proc() is called second time, what is the output?
if a person is buying coconuts of Rs10,and then sell that coconuts of Rs9,with the loss of one rupee.After that the person became a millaniore.how?
Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon
What is data structure in c and its types?
How do we open a binary file in Read/Write mode in C?
What will be result of the following program? void myalloc(char *x, int n) { x= (char *)malloc(n*sizeof(char)); memset(x,\0,n*sizeof(char)); } main() { char *g="String"; myalloc(g,20); strcpy(g,"Oldstring"); printf("The string is %s",g); } a) The string is : String b) Run time error/Core dump c) The string is : Oldstring d) Syntax error during compilation e) None of these