puzzle in C Programming Language Online Test

what will be the output of the following question?

main()

{

char far *s1,*s2;

printf("%d%d",sizeof(s1),sizeof(s2));

}


point out the error , if any, in the while loop.

main()

{

int i=1;

while()

{

printf("%d",i++);

if(i>10)

break;

}

}


are the following two statements same?

a<=20?b=30:c=30;

(a<=20)?b:c=30;


what would be the output of the following?

main()

{

printf("%f",sqrt(36.0));

}


how many times the following program would print 'sana'?

main()

{

printf("\nsana");

main();

}


what would be the output ?

#define SQR(x) (x*x)

main()

{

int a,b=3;

a=SQR(b+2);

printf("\n%d",a);

}


what would be the output of the program?

main()

{

int arr[]={12,13,14,15,16};

printf("\n%d%d%d",sizeof(arr),sizeof(*arr),sizeof(arr[0]));

}


what would be the output of the following?

main()

{

struct a

{

category:5;

scheme:4;

};

printf("size=%d",sizeof(struct a));

}

























































Description:

this test is based on c language.with more interesting puzzle.
Each question is having 4 option and u can choose one correct answer...

Discussion

siva

nice..i enjoyed while taking this test

2954 days 10 hours 15 minutes ago

venkat

any one explain question no 6 please

2964 days 7 hours 2 minutes ago

naveenkumar

answer for this question is wrong . the answer is 6.000000

2971 days 7 hours 30 minutes ago

Virkayade Jitendra

nice...test...but did u will create some questions on pointers...

2971 days 8 hours 42 minutes ago

vimjet

Comments to Authors
please specify the processor architecture.

Windows based machine will have int size 2;
unix based int 4;

3010 days 4 hours 9 minutes ago

vimjet

Comments to Authors
please specify the processor architecture.

Windows based machine will have int size 2;
unix based int 4;

3010 days 4 hours 9 minutes ago

darshan

answer for first 1st question is wrong i think .... pointers always allocated by the size 2 bytes or 4...

3024 days 13 hours 45 minutes ago

lalbahadur

Very easy got 8/8

3075 days 6 hours 9 minutes ago

pottabathiniusha

first question answer is wrong.........

3101 days 23 hours 54 minutes ago

ms

what will be the output of
main()
{
int a=5,c;
int ptr;
ptr=

3143 days 1 hours 24 minutes ago

59 Followers

Your Facebook Friends on WizIQ

More Tests By Author

puzzle on C Programming language--Part 3
5 Questions | 543 Attempts

puzzle on C programming language---part 2
10 Questions | 540 Attempts