Sunday, December 28, 2008

What is the output of following programme ?

main()
{
float b=7.7;
char a='7';
if('7'>a)
printf("this world is good and ");
else printf("not so bad after all ");
if(7.7>b)
printf("this world is good ");
else printf("not so bad after all");
}

a. not so bad after all not so bad after all
b. this world is good and this world is good
c. this world is good and not so bad after all
d. not so bad after all this world is good


Friday, December 26, 2008

What is the output of following programme ?

main()
{
char x = 0x8A;
unsigned int y = x;
printf("%d\n", y);
}
A. -118
B. 138
C. 118
D. Unpredictable

Wednesday, December 17, 2008

Which of the following is the correct output for the program given below?

main() {
char ch;
if((ch=printf(248)))
printf("You are Boss");
else
printf("I am Boss");
}

a. You are Boss
b. I am Boss
c. No output
d. None of these

Saturday, December 6, 2008

Find the output of following programme

#include
#include
int main()
{
printf("%c\n", 'mujhe khoon do main tumhe pani duungah' -3);
return 0;
}

a. warning,Outputs: -h
b. error
c. warning, Outputs: e
d. warning, Outputs: n
e. warning, Outputs: (ascii value of h)

Friday, December 5, 2008

What is the output of following programme ?

int main()
{
int a[5]={0,1,2,3,4,5};
unsigned int b = 0xffffffff;
a[b] = 30;
printf("%d\n", a[-1]);
a[-1] = 50;
printf("%d %d\n", a[-1],b);
}

a. Error
b. Garbage Garbage 1
c. 30 50 -1
d. -30 -50 1
e. None of the above

Tuesday, December 2, 2008

What is the output of following programme ?

main()
{
int a=500, b=100, c;
if(!a>=400)
b=300; c=200;
printf("b=%d c=%d", b,c);
}

a. b=300 c=200
b. b=100 c=garbage
c. b=300 c=garbage
d. b=100 c=200

Monday, December 1, 2008

According to the Standard C specification, what are the respective minimum ranges (in bytes) of the following three data types: short, int, long?

Choice a: 1, 2, 2
Choice b: 2, 4, 8
Choice c: 2, 2, 4
Choice d: 2, 4, 4
Choice e: 1, 2, 8