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...

Comments
mamta rana
By: mamta rana
697 days 13 hours 26 minutes ago

hmm.....gud one but i confused in one thing that the answer of 4 question must be 6.000000 becoz i already run this progarm in tc but the answer u given in this is differnt ........and i enjoyed while doing the test.....thnks

mamta rana
By: Sonu
2 days 15 hours 45 minutes ago

yes...i do agree...it must be 6.000000

aditya
By: aditya
693 days 4 hours 25 minutes ago

easy test i got 7 correct and 1 incorrect...

pooja
By: pooja
684 days 19 hours 51 minutes ago

can any 1 explain q3 of this test? why they are not same?

pooja
By: vallisha
598 days 19 hours 29 minutes ago

it is coz of the precedence and associativity.

sharda sharma
By: sharda sharma
673 days 23 hours 36 minutes ago

no comment

Anurag Sharma
By: Anurag Sharma
655 days 3 hours 32 minutes ago

This is Low level test for enthusiastic C programmer.......If u wanna check yourself that how good you are in C then take my test......

Lahuraj
By: Lahuraj
612 days 3 hours 13 minutes ago

great feeling while solving test, I was so excited............!!!

shobana
By: shobana
605 days 21 hours 23 minutes ago

can any one explain qn.1,6,8 plz.........

raheesa
By: raheesa
585 days 2 hours 22 minutes ago

can u explain Q6

raheesa
By: Raja
209 days 19 hours 50 minutes ago

the macro expanded as
b 2*b 2

GANESH KAMATH
By: GANESH KAMATH
574 days 23 hours 47 minutes ago

i think in the exam review there should be a proper explaination of how the answer was arrived for the better understanding of someone like me.

PRAVEEN
By: PRAVEEN
500 days 18 hours 29 minutes ago

ya good.........

but still i expect some depth concepts with clear explanation
if possible

ojom pandey
By: ojom pandey
489 days 15 hours 15 minutes ago

its great feeling to give the test.A must for an enthusiastic programmer.

M Kula Shekar
By: M Kula Shekar
468 days 1 hours 25 minutes ago

thanks for providing such opportunity to prove ourself.
thanks to WIZIQ.

ms
By: ms
440 days 16 hours 55 minutes ago

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

pottabathiniusha
By: pottabathiniusha
399 days 15 hours 25 minutes ago

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

lalbahadur
By: lalbahadur
372 days 21 hours 40 minutes ago

Very easy got 8/8

darshan
By: darshan
322 days 5 hours 16 minutes ago

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

vimjet
By: vimjet
307 days 19 hours 40 minutes ago

Comments to Authors
please specify the processor architecture.

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

vimjet
By: vimjet
307 days 19 hours 40 minutes ago

Comments to Authors
please specify the processor architecture.

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

Virkayade Jitendra
By: Virkayade Jitendra
269 days 13 minutes ago

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

naveenkumar
By: naveenkumar
268 days 23 hours 1 minutes ago

answer for this question is wrong . the answer is 6.000000

venkat
By: venkat
261 days 22 hours 34 minutes ago

any one explain question no 6 please

siva
By: siva
252 days 1 hours 46 minutes ago

nice..i enjoyed while taking this test

Want to learn?

Sign up and browse through relevant courses.

Name:
Your Email:
Password:
Country:
Contact no:


Area code Number
Subjects you are interested in:
Word verification: (Enter the text as in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy
51 Followers

Your Facebook Friends on WizIQ

More Tests By Author

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

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

Give live classes, create & sell online courses

Try it free Plans & Pricing

Connect