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